Skip to content

Commit

Permalink
Fixed env variable definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
dorukgezici committed Sep 28, 2024
1 parent 02d15d8 commit 0e957e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 5 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
},
Expand Down

0 comments on commit 0e957e3

Please sign in to comment.