Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: TT-610 Fix pipeline - read from OS env variable in .ts
  • Loading branch information
almeida-erick committed Apr 16, 2022
commit a627255b3f8d97dac2ef767b5fe430a8390ba946
4 changes: 2 additions & 2 deletions .github/workflows/CI-time-tracker-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}
run: |
chmod +x ./scripts/populate-keys.sh
sh ./scripts/populate-keys.sh
chmod +x ./scripts/populate-var-file.sh
sh ./scripts/populate-var-file.sh

- name: Running tests
run: npm run ci-test --if-present
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "ng build --prod",
"test": "ng test --browsers ChromeHeadless",
"test-headless": "ng test --browsers ChromeHeadless",
"ci-test": "npm run config && ng test --no-watch --no-progress --browsers ChromeHeadless",
"ci-test": "ng test --no-watch --no-progress --browsers ChromeHeadless",
"lint": "ng lint",
"e2e": "ng e2e"
},
Expand Down
10 changes: 10 additions & 0 deletions scripts/populate-var-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

> src/environments/keys.ts
echo 'export const AUTHORITY = "'$AUTHORITY'";' >> src/environments/keys.ts
echo 'export const CLIENT_ID = "'$CLIENT_ID'";' >> src/environments/keys.ts
echo 'export const SCOPES = ["'$SCOPES'"];' >> src/environments/keys.ts
echo 'export const STACK_EXCHANGE_ID = "'$STACK_EXCHANGE_ID'";' >> src/environments/keys.ts
echo 'export const STACK_EXCHANGE_ACCESS_TOKEN = "'$STACK_EXCHANGE_ACCESS_TOKEN'";' >> src/environments/keys.ts
echo 'export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = "'$AZURE_APP_CONFIGURATION_CONNECTION_STRING'";' >> src/environments/keys.ts
cat src/environments/keys.ts
13 changes: 6 additions & 7 deletions scripts/setenv.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const { writeFile } = require('fs');
require('dotenv').config();

const pathJs = `./src/environments/keys.ts`
const contentKeys =
`export const AUTHORITY = '${process.env.AUTHORITY}';
export const CLIENT_ID = '${process.env.CLIENT_ID}';
export const SCOPES = ['${process.env.SCOPES}'];
export const STACK_EXCHANGE_ID = '${process.env.STACK_EXCHANGE_ID}';
export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env.STACK_EXCHANGE_ACCESS_TOKEN}';
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env.AZURE_APP_CONFIGURATION_CONNECTION_STRING}';
`export const AUTHORITY = '${process.env["AUTHORITY"]}';
export const CLIENT_ID = '${process.env["CLIENT_ID"]}';
export const SCOPES = ['${process.env["SCOPES"]}'];
export const STACK_EXCHANGE_ID = '${process.env["STACK_EXCHANGE_ID"]}';
export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env["STACK_EXCHANGE_ACCESS_TOKEN"]}';
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"]}';
`;

writeFile(pathJs, contentKeys, function (err) {
Expand Down