Skip to content

Commit

Permalink
Netlify: Change env var import in keystatic config
Browse files Browse the repository at this point in the history
Which might resolve our build issue withastro/astro#10007 (comment)
  • Loading branch information
tordans committed Sep 6, 2024
1 parent cec7f56 commit 336f095
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ KEYSTATIC_SECRET=

# ASTRO_OUTPUT_MODE=hybrid # static
# ASTRO_USE_NETLIFY_ADAPTER=false # true
# ASTRO_STORAGE_KIND=local # github
# PUBLIC_ASTRO_STORAGE_KIND=local # github
2 changes: 1 addition & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ASTRO_OUTPUT_MODE=hybrid
ASTRO_USE_NETLIFY_ADAPTER=false
ASTRO_STORAGE_KIND=local
PUBLIC_ASTRO_STORAGE_KIND=local
2 changes: 1 addition & 1 deletion .env.netlify
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ASTRO_OUTPUT_MODE=hybrid
ASTRO_USE_NETLIFY_ADAPTER=true
ASTRO_STORAGE_KIND=github
PUBLIC_ASTRO_STORAGE_KIND=github
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
env:
ASTRO_OUTPUT_MODE: "static"
ASTRO_USE_NETLIFY_ADAPTER: "false"
ASTRO_STORAGE_KIND: "local"
PUBLIC_ASTRO_STORAGE_KIND: "local"
# with:
# path: . # The root location of your Astro project inside the repository. (optional)
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)
Expand Down
7 changes: 1 addition & 6 deletions keystatic.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ import { config } from '@keystatic/core'
import { keystaticPostsConfig } from 'keystatic/keystatic.posts.config'
import { keystaticProjectsConfig } from 'keystatic/keystatic.projects.config'

// See ./astro.config.mjs
import { loadEnv } from 'vite'
const { ASTRO_STORAGE_KIND } = loadEnv(process.env.NODE_ENV!, process.cwd(), '')

export default config({
storage: {
// https://keystatic.com/docs/github-mode#setting-up-git-hub-mode
// @ts-expect-error
kind: ASTRO_STORAGE_KIND,
kind: import.meta.env.PUBLIC_ASTRO_STORAGE_KIND,
repo: {
owner: 'osmberlin',
name: 'www.osm-verkehrswende.org',
Expand Down
2 changes: 1 addition & 1 deletion src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare module '*.astro'
interface ImportMetaEnv {
readonly ASTRO_OUTPUT_MODE: 'hybrid' | 'static'
readonly ASTRO_USE_NETLIFY_ADAPTER: 'true' | 'false'
readonly ASTRO_STORAGE_KIND: 'local' | 'github'
readonly PUBLIC_ASTRO_STORAGE_KIND: 'local' | 'github'
}

interface ImportMeta {
Expand Down

0 comments on commit 336f095

Please sign in to comment.