Skip to content

Commit c8e572a

Browse files
committed
injecting env files
1 parent a3afc0b commit c8e572a

File tree

9 files changed

+23
-55
lines changed

9 files changed

+23
-55
lines changed

.github/workflows/time-tracker-ui-cd-stage.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ jobs:
3232
- name: Build the docker image
3333
run: make build_prod
3434

35+
- name: Inject Secrets
36+
env:
37+
SCOPES: ${{ secrets.SCOPES }}
38+
CLIENT_ID: ${{ secrets.CLIENT_ID}}
39+
CLIENT_URL: ${{ secrets.CLIENT_URL }}
40+
AUTHORITY: ${{ secrets.AUTHORITY }}
41+
STACK_EXCHANGE_ID: ${{ secrets.STACK_EXCHANGE_ID }}
42+
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}
43+
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}
44+
run: |
45+
chmod +x ./scripts/populate-keys.sh
46+
sh ./scripts/populate-keys.sh
47+
3548
- name: Publish docker image to stage azure container registry
3649
run: |
3750
make login publish acr=timetrackerservicestageregistry image_tag=$RELEASE_VERSION
@@ -46,22 +59,10 @@ jobs:
4659
with:
4760
ssh-private-key: ${{ secrets.INFRA_TERRAFORM_MODULES_SSH_PRIV_KEY }}
4861

49-
- name: append secret to secret.auto.tfvars
50-
working-directory: ./${{ env.WORKING_DIR }}
51-
run: |
52-
./append_secret.py CHROME_BIN /opt/google/chrome/google-chrome
53-
./append_secret.py AUTHORITY "${{ secrets.AUTHORITY }}"
54-
./append_secret.py CLIENT_ID "${{ secrets.CLIENT_ID }}"
55-
./append_secret.py SCOPES "${{ secrets.SCOPES }}"
56-
./append_secret.py STACK_EXCHANGE_ID "${{ secrets.STACK_EXCHANGE_ID }}"
57-
./append_secret.py STACK_EXCHANGE_ACCESS_TOKEN "${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}"
58-
./append_secret.py AZURE_APP_CONFIGURATION_CONNECTION_STRING "${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}"
59-
60-
6162
- name: Terraform Init
6263
working-directory: ${{ env.WORKING_DIR }}
6364
run: terraform init
6465

6566
- name: Terraform Apply
6667
working-directory: ${{ env.WORKING_DIR }}
67-
run: terraform apply -lock=false -var-file="${{ env.TF_WORKSPACE }}.tfvars" -var "image_tag=$RELEASE_VERSION" -auto-approve
68+
run: terraform apply -lock=false -var-file="${{ env.TF_WORKSPACE }}.tfvars" -var "image_tag=$RELEASE_VERSION" -auto-approve

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
env:
3838
SCOPES: ${{ secrets.SCOPES }}
3939
CLIENT_ID: ${{ secrets.CLIENT_ID }}
40+
CLIENT_URL: ${{ secrets.CLIENT_URL }}
4041
AUTHORITY: ${{ secrets.AUTHORITY }}
4142
STACK_EXCHANGE_ID: ${{ secrets.STACK_EXCHANGE_ID }}
4243
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}
@@ -45,17 +46,6 @@ jobs:
4546
chmod +x ./scripts/populate-keys.sh
4647
sh ./scripts/populate-keys.sh
4748
48-
- name: append secret to secret.auto.tfvars
49-
working-directory: ./${{ env.WORKING_DIR }}
50-
run: |
51-
./append_secret.py CHROME_BIN /opt/google/chrome/google-chrome
52-
./append_secret.py AUTHORITY "${{ secrets.AUTHORITY }}"
53-
./append_secret.py CLIENT_ID "${{ secrets.CLIENT_ID }}"
54-
./append_secret.py SCOPES "${{ secrets.SCOPES }}"
55-
./append_secret.py STACK_EXCHANGE_ID "${{ secrets.STACK_EXCHANGE_ID }}"
56-
./append_secret.py STACK_EXCHANGE_ACCESS_TOKEN "${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}"
57-
./append_secret.py AZURE_APP_CONFIGURATION_CONNECTION_STRING "${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}"
58-
5949
- name: Running tests
6050
run: |
6151
chmod -R 777 ./$home
@@ -142,11 +132,10 @@ jobs:
142132
repo: context.repo.repo,
143133
body: output
144134
})
145-
146135
- name: Terraform Plan Stage Status
147136
if: steps.plan-stage.outcome == 'failure'
148137
run: exit 1
149138

150139
- name: Terraform Plan Prod Status
151140
if: steps.plan-prod.outcome == 'failure'
152-
run: exit 1
141+
run: exit 1

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
environment:
1313
AUTHORITY: ${AUTHORITY}
1414
CLIENT_ID: ${CLIENT_ID}
15+
CLIENT_URL: ${CLIENT_URL}
1516
SCOPES: ${SCOPES}
1617
STACK_EXCHANGE_ID: ${STACK_EXCHANGE_ID}
1718
STACK_EXCHANGE_ACCESS_TOKEN: ${STACK_EXCHANGE_ACCESS_TOKEN}

infrastructure/append_secret.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

scripts/populate-keys.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
> .env
44
echo "AUTHORITY='$AUTHORITY'" >> .env
55
echo "CLIENT_ID='$CLIENT_ID'" >> .env
6+
echo "CLIENT_URL='$CLIENT_URL'" >> .env
67
echo "SCOPES='$SCOPES'" >> .env
78
echo "STACK_EXCHANGE_ID='$STACK_EXCHANGE_ID'" >> .env
89
echo "STACK_EXCHANGE_ACCESS_TOKEN='$STACK_EXCHANGE_ACCESS_TOKEN'" >> .env

src/app/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import { ProjectEffects } from './modules/customer-management/components/project
4646
import { TechnologyEffects } from './modules/shared/store/technology.effects';
4747
import { ProjectTypeEffects } from './modules/customer-management/components/projects-type/store/project-type.effects';
4848
import { reducers, metaReducers } from './reducers';
49-
import { environment } from '../environments/environment';
49+
import { environment, CLIENT_URL } from '../environments/environment';
5050
import { CustomerComponent } from './modules/customer-management/pages/customer.component';
5151
// tslint:disable-next-line: max-line-length
5252
import { CustomerListComponent } from './modules/customer-management/components/customer-info/components/customer-list/customer-list.component';
@@ -207,7 +207,7 @@ const maskConfig: Partial<IConfig> = {
207207
{
208208
id: GoogleLoginProvider.PROVIDER_ID,
209209
provider: new GoogleLoginProvider(
210-
'565556796659-hscrj9e6m2krc41cfng898793ocfnb8j.apps.googleusercontent.com'
210+
CLIENT_URL
211211
)
212212
}
213213
]

src/environments/environment.prod.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const environment = {
77

88
export const AUTHORITY = process.env["AUTHORITY"];
99
export const CLIENT_ID = process.env["CLIENT_ID"];
10+
export const CLIENT_URL = process.env["CLIENT_URL"];
1011
export const SCOPES = process.env["SCOPES"].split(",");
1112
export const ITEMS_PER_PAGE = 5;
1213
export const STACK_EXCHANGE_ID = process.env["STACK_EXCHANGE_ID"];

src/environments/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const environment = {
1010

1111
export const AUTHORITY = process.env["AUTHORITY"];
1212
export const CLIENT_ID = process.env["CLIENT_ID"];
13+
export const CLIENT_URL = process.env["CLIENT_URL"];
1314
export const SCOPES = process.env["SCOPES"].split(",");
1415
export const ITEMS_PER_PAGE = 5;
1516
export const STACK_EXCHANGE_ID = process.env["STACK_EXCHANGE_ID"];

webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = (config) => {
1010
new webpack.DefinePlugin({
1111
'process.env.AUTHORITY': JSON.stringify(process.env["AUTHORITY"]),
1212
'process.env.CLIENT_ID':JSON.stringify(process.env["CLIENT_ID"]),
13+
'process.env.CLIENT_URL':JSON.stringify(process.env["CLIENT_URL"]),
1314
'process.env.SCOPES':JSON.stringify(process.env["SCOPES"]),
1415
'process.env.STACK_EXCHANGE_ID':JSON.stringify(process.env["STACK_EXCHANGE_ID"]),
1516
'process.env.STACK_EXCHANGE_ACCESS_TOKEN':JSON.stringify(process.env["STACK_EXCHANGE_ACCESS_TOKEN"]),

0 commit comments

Comments
 (0)