Skip to content

Commit 7748679

Browse files
committed
fix: TT-610 Fix pipeline - read from OS env variable in .ts
1 parent 17c1a53 commit 7748679

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

.github/workflows/CI-time-tracker-ui.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}
4949
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}
5050
run: |
51-
chmod +x ./scripts/populate-keys.sh
52-
sh ./scripts/populate-keys.sh
51+
chmod +x ./scripts/populate-var-file.sh
52+
sh ./scripts/populate-var-file.sh
5353
5454
- name: Running tests
5555
run: npm run ci-test --if-present

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "ng build --prod",
1010
"test": "ng test --browsers ChromeHeadless",
1111
"test-headless": "ng test --browsers ChromeHeadless",
12-
"ci-test": "npm run config && ng test --no-watch --no-progress --browsers ChromeHeadless",
12+
"ci-test": "ng test --no-watch --no-progress --browsers ChromeHeadless",
1313
"lint": "ng lint",
1414
"e2e": "ng e2e"
1515
},

scripts/populate-var-file.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
> src/environments/keys.ts
4+
echo 'export const AUTHORITY = "'$AUTHORITY'";' >> src/environments/keys.ts
5+
echo 'export const CLIENT_ID = "'$CLIENT_ID'";' >> src/environments/keys.ts
6+
echo 'export const SCOPES = ["'$SCOPES'"];' >> src/environments/keys.ts
7+
echo 'export const STACK_EXCHANGE_ID = "'$STACK_EXCHANGE_ID'";' >> src/environments/keys.ts
8+
echo 'export const STACK_EXCHANGE_ACCESS_TOKEN = "'$STACK_EXCHANGE_ACCESS_TOKEN'";' >> src/environments/keys.ts
9+
echo 'export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = "'$AZURE_APP_CONFIGURATION_CONNECTION_STRING'";' >> src/environments/keys.ts
10+
cat src/environments/keys.ts

scripts/setenv.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
const { writeFile } = require('fs');
2-
require('dotenv').config();
32

43
const pathJs = `./src/environments/keys.ts`
54
const contentKeys =
6-
`export const AUTHORITY = '${process.env.AUTHORITY}';
7-
export const CLIENT_ID = '${process.env.CLIENT_ID}';
8-
export const SCOPES = ['${process.env.SCOPES}'];
9-
export const STACK_EXCHANGE_ID = '${process.env.STACK_EXCHANGE_ID}';
10-
export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env.STACK_EXCHANGE_ACCESS_TOKEN}';
11-
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env.AZURE_APP_CONFIGURATION_CONNECTION_STRING}';
5+
`export const AUTHORITY = '${process.env["AUTHORITY"]}';
6+
export const CLIENT_ID = '${process.env["CLIENT_ID"]}';
7+
export const SCOPES = ['${process.env["SCOPES"]}'];
8+
export const STACK_EXCHANGE_ID = '${process.env["STACK_EXCHANGE_ID"]}';
9+
export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env["STACK_EXCHANGE_ACCESS_TOKEN"]}';
10+
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"]}';
1211
`;
1312

1413
writeFile(pathJs, contentKeys, function (err) {
1514
if (err) {
1615
console.log(err);
1716
}
1817
console.log(`Wrote variables to ${pathJs}`);
18+
console.log(`Wrote variables to ${process.env["SCOPES"]}`);
19+
console.log(`Wrote variables to ${process.env["STACK_EXCHANGE_ID"]}`);
1920
});
2021

2122
const pathJson = `./src/environments/.keys.json`

0 commit comments

Comments
 (0)