From c0cecb563234d0157667a45305c91c8834456d0d Mon Sep 17 00:00:00 2001 From: Korbs Date: Fri, 7 Jun 2024 03:15:10 -0400 Subject: [PATCH] Don't run Keystatic in production and export vars --- astro.config.mjs | 26 ++++++++++++++++++++------ src/utils/GetConfig.js | 27 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 src/utils/GetConfig.js diff --git a/astro.config.mjs b/astro.config.mjs index c13406e..650b4f5 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,9 +1,11 @@ import { defineConfig } from 'astro/config'; -const SITE_NAME = import.meta.env.SITE_NAME; -const SITE_PROTOCOL = import.meta.env.SITE_PROTOCOL; -const SITE_DOMAIN = import.meta.env.SITE_DOMAIN; -const SITE_BASE = import.meta.env.SITE_BASE; +// Environment Variables +import { + SITE_PROTOCOL, + SITE_DOMAIN, + SITE_BASE +} from './src/utils/GetConfig' // Adapters import node from '@astrojs/node'; @@ -12,21 +14,33 @@ import node from '@astrojs/node'; import keystatic from '@keystatic/astro'; import mdx from '@astrojs/mdx'; import partytown from '@astrojs/partytown'; +import react from '@astrojs/react'; export default defineConfig({ + // Information site: SITE_PROTOCOL + '://' + SITE_DOMAIN, base: SITE_BASE, + // Integrations + integrations: [ + mdx(), + partytown(), + react(), + // Disable Keystatic in production + // https://keystatic.com/docs/recipes/astro-disable-admin-ui-in-production + ...(process.env.SKIP_KEYSTATIC ? [] : [keystatic()]) + ], + // Server Output output: "hybrid", prefetch: true, adapter: node({ mode: 'standalone', }), - integrations: [mdx(), partytown()], server: { port: 2014, host: true }, + // Others devToolbar: { enabled: false } -}); +}); \ No newline at end of file diff --git a/src/utils/GetConfig.js b/src/utils/GetConfig.js new file mode 100644 index 0000000..25712e0 --- /dev/null +++ b/src/utils/GetConfig.js @@ -0,0 +1,27 @@ +export var ORG_NAME = import.meta.env.ORG_NAME; +export var SITE_NAME = import.meta.env.SITE_NAME; +export var SITE_PROTOCOL = import.meta.env.SITE_PROTOCOL; +export var SITE_DOMAIN = import.meta.env.SITE_DOMAIN; +export var SITE_BASE = import.meta.env.SITE_BASE; +export var META_COLOR = import.meta.env.META_COLOR; +export var COLOR = import.meta.env.COLOR; +export var THEME = import.meta.env.THEME; +export var SIDEBAR_SIZE = import.meta.env.SIDEBAR_SIZE; +export var SIDEBAR_ICONS = import.meta.env.SIDEBAR_ICONS; +export var THEME_TOGGLE_ENABLED = import.meta.env.THEME_TOGGLE_ENABLED; +export var THEME_TOGGLE_STYLE = import.meta.env.THEME_TOGGLE_STYLE; +export var CMS_DASHBOARD_LOGO_DARK = import.meta.env.CMS_DASHBOARD_LOGO_DARK; +export var CMS_DASHBOARD_LOGO_LIGHT = import.meta.env.CMS_DASHBOARD_LOGO_LIGHT; +export var WHITELABEL = import.meta.env.WHITELABEL; +export var FOOTER_VERSION = import.meta.env.FOOTER_VERSION; +export var REVERT_LAYOUT = import.meta.env.REVERT_LAYOUT; +export var FEEDBACK_ENABLED = import.meta.env.FEEDBACK_ENABLED; +export var FEELBACK_ENABLED = import.meta.env.FEELBACK_ENABLED; +export var ANALYTICS = import.meta.env.ANALYTICS; +export var MATOMO_ID = import.meta.env.MATOMO_ID; +export var MATOMO_SRC = import.meta.env.MATOMO_SRC; +export var PLAUSIBLE_DOMAIN = import.meta.env.PLAUSIBLE_DOMAIN; +export var PLAUSIBLE_SRC = import.meta.env.PLAUSIBLE_SRC; +export var UMAMI_ID = import.meta.env.UMAMI_ID; +export var UMAMI_SRC = import.meta.env.UMAMI_SRC; +export var AMPLITUDE_APIKEY = import.meta.env.AMPLITUDE_APIKEY; \ No newline at end of file