Skip to content

Commit 30d6462

Browse files
author
Laszlo Simon
committed
fix: environmet issue
1 parent 6365341 commit 30d6462

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,17 @@ jobs:
3131
- name: Install dependencies
3232
run: npm i
3333

34+
- name: Generate environment configuration
35+
run: |
36+
jq \
37+
--arg accessKey "${WEB3FORMS_ACCESS_KEY}" \
38+
'.production = true | .contactFormAccessKey = $accessKey' \
39+
src/environments/environment.example.json > src/environments/environment.json
40+
env:
41+
WEB3FORMS_ACCESS_KEY: ${{ secrets.WEB3FORMS_ACCESS_KEY }}
42+
3443
- name: Build Angular app for GitHub Pages
3544
run: npm run build -- --configuration production
36-
env:
37-
NG_APP_CONTACT_FORM_ACCESS_KEY: ${{ secrets.WEB3FORMS_ACCESS_KEY }}
3845

3946
- name: Upload artifact
4047
uses: actions/upload-pages-artifact@v3

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ __screenshots__/
4242
# System files
4343
.DS_Store
4444
Thumbs.db
45+
46+
environment.json
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"production": false,
3+
"contactFormAccessKey": "your-access-key-here"
4+
}

src/environments/environment.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
import json from './environment.json';
2+
13
export interface Environment {
24
readonly production: boolean;
35
readonly contactFormAccessKey: string;
46
}
57

68
export const environment: Environment = {
7-
production: import.meta.env.PROD,
8-
contactFormAccessKey:
9-
import.meta.env.NG_APP_CONTACT_FORM_ACCESS_KEY ??
10-
import.meta.env.VITE_CONTACT_FORM_ACCESS_KEY ??
11-
'',
9+
production: json.production,
10+
contactFormAccessKey: json.contactFormAccessKey,
1211
};

0 commit comments

Comments
 (0)