Skip to content

Commit 947f45f

Browse files
TT-610-Time-Tracker-Keys-Pipeline-ENV (#845)
* fix: TT-610 Fix pipeline * fix: TT-610 Fix pipeline - CI Time Tracker ui * fix: TT-610 Fix pipeline - read from OS env variable in .ts
1 parent da1792f commit 947f45f

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
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

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cleanup: ## Delete image timetracker_ui
1919

2020
.PHONY: run
2121
run: ## Execute timetracker_ui docker containe.
22-
docker-compose --env-file ./.env up -d
22+
docker-compose up -d
2323

2424
.PHONY: logs
2525
logs: ## Show logs of timetracker_ui.
@@ -40,12 +40,12 @@ remove: ## Delete container timetracker_ui.
4040

4141
.PHONY: test
4242
test: ## Run all tests on docker container timetracker_ui at the CLI.
43-
docker-compose -f docker-compose.yml --env-file ./.env up -d
43+
docker-compose -f docker-compose.yml up -d
4444
docker exec timetracker_ui bash -c "npm run ci-test"
4545

4646
.PHONY: testdev
4747
testdev: ## Run all tests on docker container timetracker_ui at the Dev
48-
docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file ./.env up -d
48+
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
4949
docker exec timetracker_ui bash -c "npm run ci-test"
5050

5151
.PHONY: publish

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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
const { writeFile } = require('fs');
2-
require('dotenv').config();
32

43
const pathJs = `./src/environments/keys.ts`
5-
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}';
4+
const contentKeys =
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) {
@@ -19,7 +18,7 @@ writeFile(pathJs, contentKeys, function (err) {
1918
});
2019

2120
const pathJson = `./src/environments/.keys.json`
22-
const contentKeysJson =
21+
const contentKeysJson =
2322
`{
2423
"authority": "${process.env.AUTHORITY_JSON}",
2524
"client_id": "${process.env.CLIENT_ID_JSON}",

0 commit comments

Comments
 (0)