Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-lefebvre authored and astrobot-houston committed Jul 9, 2024
1 parent 0a4b31f commit ea8582f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ export interface AstroUserConfig {
* Whether or not to validate secrets on the server when starting the dev server or running a build.
*
* By default, only public variables are validated on the server when starting the dev server or a build, and private variables are validated at runtime only. If enabled, private variables will also be checked on start. This is useful in some continuous integration (CI) pipelines to make sure all your secrets are correctly set before deploying.
*
*
* ```js
* // astro.config.mjs
* import { defineConfig, envField } from "astro/config"
Expand Down
9 changes: 6 additions & 3 deletions packages/astro/src/core/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const ASTRO_CONFIG_DEFAULTS = {
globalRoutePriority: false,
rewriting: false,
env: {
validateSecrets: false
}
validateSecrets: false,
},
},
} satisfies AstroUserConfig & { server: { open: boolean } };

Expand Down Expand Up @@ -529,7 +529,10 @@ export const AstroConfigSchema = z.object({
env: z
.object({
schema: EnvSchema.optional(),
validateSecrets: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.env.validateSecrets)
validateSecrets: z
.boolean()
.optional()
.default(ASTRO_CONFIG_DEFAULTS.experimental.env.validateSecrets),
})
.strict()
.optional(),
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/test/env-secret.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ describe('astro:env secret variables', () => {
afterEach(async () => {
await devServer?.stop();
if (process.env.KNOWN_SECRET) {
delete process.env.KNOWN_SECRET
delete process.env.KNOWN_SECRET;
}
});

it('works in dev', async () => {
process.env.KNOWN_SECRET = '5'
process.env.KNOWN_SECRET = '5';
fixture = await loadFixture({
root: './fixtures/astro-env-server-secret/',
});
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('astro:env secret variables', () => {

try {
await fixture.build();
assert.fail()
assert.fail();
} catch (error) {
assert.equal(error instanceof Error, true);
assert.equal(error.title, 'Invalid Environment Variables');
Expand Down

0 comments on commit ea8582f

Please sign in to comment.