Skip to content

Commit

Permalink
re-enable dynamic env for dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Dec 30, 2020
1 parent 7935208 commit 40ac215
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.15.1-buster AS builder
FROM node:14.15.3-stretch AS builder

WORKDIR /oengus-frontend
COPY package.json package-lock.json ./
Expand Down
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.dev.ts"
"with": "src/environments/environment.dynamic.ts"
}
],
"optimization": true,
Expand Down
6 changes: 1 addition & 5 deletions src/app/resolvers/patrons-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export class PatronsResolver implements Resolve<PatronApiResponse> {

resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
Observable<PatronApiResponse> | Promise<PatronApiResponse> | PatronApiResponse {
return this.http.get<PatronApiResponse>(`${this.patronUrl}/patrons`);
}

private get patronUrl(): string {
return environment.patronApi || environment.api + '/patreon';
return this.http.get<PatronApiResponse>(`${environment.patronApi}/patrons`);
}
}
12 changes: 0 additions & 12 deletions src/environments/environment.dev.ts

This file was deleted.

21 changes: 15 additions & 6 deletions src/environments/environment.dynamic.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.

// TODO: look into performance impact with getters

export const environment = {
twitchClientId: 'f4ry4d9k0dt89ha8ks7cb845trvbod',
discordClientId: '559625844197163008',
paypalClientId: 'Ac7rzLgpb5emA9JuRxRXpRDVMdULzgA_BxwyhPlAxPHtg1NtDv3nyjLcWgHBOUEmtdWJ5npWnMN-b7_8',

// returns true for production builds
get production() {
Expand Down Expand Up @@ -38,7 +33,21 @@ export const environment = {
},
get syncRedirect() {
return environment.baseSite + '/user/settings/sync/';
}
},
get paypalClientId() {
if (environment.production) {
return 'AfkLlDPvmM0v1914bih8VN0x0LZps-jkjdz-A7ydiJ0RVPdaAC730VWtVkTWaXZauBYVs3UbaoRHc6VH';
}

return 'AV9-0fSGWREDWpnMJujrHUbDIibragMgE4-4HuAS-WQPlgHSRyfeU5iqNyiQwLEGZFEKhAiERJdv80a4';
},
get patronApi() {
if (environment.production) {
return environment.api + '/patreon';
}

return 'http://localhost:9000';
},
};

/*
Expand Down

0 comments on commit 40ac215

Please sign in to comment.