Use env in astro config file
This commit is contained in:
parent
5d1b088b07
commit
c1f97ce86e
|
@ -2,6 +2,8 @@ import icon from "astro-icon";
|
||||||
import { defineConfig } from "astro/config";
|
import { defineConfig } from "astro/config";
|
||||||
import node from "@astrojs/node";
|
import node from "@astrojs/node";
|
||||||
import astroMetaTags from "astro-meta-tags";
|
import astroMetaTags from "astro-meta-tags";
|
||||||
|
import { loadEnv } from "vite";
|
||||||
|
const { ASTRO_PORT, ASTRO_HOST } = loadEnv(process.env.NODE_ENV, process.cwd(), "");
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
@ -22,7 +24,9 @@ export default defineConfig({
|
||||||
],
|
],
|
||||||
// devToolbar: { enabled: false },
|
// devToolbar: { enabled: false },
|
||||||
server: {
|
server: {
|
||||||
port: 12499,
|
port: parseInt(ASTRO_PORT),
|
||||||
host: true,
|
host: ASTRO_HOST,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(import.meta.env)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,11 +9,11 @@
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"astro": "astro",
|
"astro": "astro",
|
||||||
"upgrade": "ncu",
|
"upgrade": "ncu",
|
||||||
"script:download-payload-sdk": "bun run scripts/download-payload-sdk.ts",
|
"script:download-payload-sdk": "npm run scripts/download-payload-sdk.ts",
|
||||||
"script:download-currencies": "bun run scripts/download-currencies.ts",
|
"script:download-currencies": "npm run scripts/download-currencies.ts",
|
||||||
"script:download-wording-keys": "bun run scripts/download-wording-keys.ts",
|
"script:download-wording-keys": "npm run scripts/download-wording-keys.ts",
|
||||||
"prettier": "prettier --write --list-different --plugin=prettier-plugin-astro .",
|
"prettier": "prettier --write --list-different --plugin=prettier-plugin-astro .",
|
||||||
"precommit": "bun run script:download-wording-keys && bun run script:download-payload-sdk && bun run prettier && bun run astro check"
|
"precommit": "npm run script:download-wording-keys && npm run script:download-payload-sdk && npm run prettier && npm run astro check"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"npm": ">=10.0.0",
|
"npm": ">=10.0.0",
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
npm run dev
|
Loading…
Reference in New Issue