From 0e957e39c910db2b6d2d4f9e0975a67405069643 Mon Sep 17 00:00:00 2001 From: Doruk Gezici Date: Sat, 28 Sep 2024 13:45:38 +0200 Subject: [PATCH] Fixed env variable definitions --- astro.config.mjs | 2 +- package.json | 2 +- src/main.ts | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index d804366..1072db0 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -6,7 +6,7 @@ export default defineConfig({ schema: { OAUTH_GITHUB_CLIENT_ID: envField.string({ context: "server", access: "secret" }), OAUTH_GITHUB_CLIENT_SECRET: envField.string({ context: "server", access: "secret" }), - PUBLIC_DECAP_CMS_VERSION: envField.string({ context: "client", access: "public" }), + PUBLIC_DECAP_CMS_VERSION: envField.string({ context: "client", access: "public", optional: true }), }, }, }, diff --git a/package.json b/package.json index dfbf6e5..66409ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "astro-decap-cms-oauth", - "version": "0.4.0", + "version": "0.4.1", "description": "Add Decap CMS’s admin dashboard and a custom OAuth backend to your Astro project", "keywords": [ "astro-integration", diff --git a/src/main.ts b/src/main.ts index e75b4d9..4ea301e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,17 +32,19 @@ export default function decapCMS(options: DecapCMSOptions): AstroIntegration { return { name: "astro-decap-cms-oauth", hooks: { - "astro:config:setup": async ({ config, injectRoute, updateConfig }) => { + "astro:config:setup": async ({ injectRoute, updateConfig }) => { if (!adminDisabled) { - // apply env schema & version + // apply env schema & decapCMS version updateConfig({ experimental: { env: { schema: { - ...config.experimental.env?.schema, + OAUTH_GITHUB_CLIENT_ID: envField.string({ context: "server", access: "secret" }), + OAUTH_GITHUB_CLIENT_SECRET: envField.string({ context: "server", access: "secret" }), PUBLIC_DECAP_CMS_VERSION: envField.string({ context: "client", access: "public", + optional: true, default: decapCMSVersion, }), },