Skip to content

Commit 72d8de0

Browse files
authored
Merge pull request #124 from CodeGov-org/nathan/fix-env-loading
ci: fix env loading
2 parents 5a8d8f0 + be76ef7 commit 72d8de0

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/frontend/pull-global-config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { fileURLToPath } from 'node:url';
77
dotenv.config({
88
path: '.env',
99
});
10+
dotenv.config({
11+
path: '../../.env',
12+
});
1013

1114
const __filename = fileURLToPath(import.meta.url);
1215
const __dirname = dirname(__filename);

src/marketing/astro.config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import storyblok from '@storyblok/astro';
33
import basicSsl from '@vitejs/plugin-basic-ssl';
44
import { loadEnv } from 'vite';
55
import netlify from '@astrojs/netlify';
6+
import path from 'path';
67

8+
const globalEnvPath = path.resolve(process.cwd(), '..', '..');
9+
const globalEnv = loadEnv('', globalEnvPath, 'DFX_NETWORK');
710
const env = loadEnv('', process.cwd(), 'STORYBLOK_TOKEN');
811

9-
const dfxNetwork = process.env.DFX_NETWORK ?? 'local';
12+
const dfxNetwork = globalEnv.DFX_NETWORK ?? 'local';
1013
const isMainnet = dfxNetwork === 'ic';
1114
const isStaging = dfxNetwork === 'staging';
1215

src/marketing/src/environment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import dotenv from 'dotenv';
2+
import path from 'path';
23

34
dotenv.config({
4-
path: '.env',
5+
path: path.resolve(process.cwd(), '..', '..', '.env'),
56
});
67

78
const dfxNetwork = process.env.DFX_NETWORK ?? 'local';

turbo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
"angular.json",
1010
"dfx.json",
1111
"prettier.config.cjs",
12-
"tsconfig.json",
13-
".env"
12+
"tsconfig.json"
1413
],
1514
"tasks": {
1615
"build": {
1716
"outputs": ["dist/**", "build/**", ".docusaurus/**", "loader/**", "www"],
17+
"inputs": ["$TURBO_DEFAULT$", ".env"],
1818
"dependsOn": ["^build"]
1919
},
2020
"test": {

0 commit comments

Comments
 (0)