Feature/set public stripe key dynamically (#216)
* Set public Stripe key dynamically * Update changelogpull/217/head
parent
39a76f7f40
commit
51fbc538ca
@ -1,6 +1,6 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
lastPublish: '{BUILD_TIMESTAMP}',
|
lastPublish: '{BUILD_TIMESTAMP}',
|
||||||
production: true,
|
production: true,
|
||||||
stripePublicKey: '{STRIPE_PUBLIC_KEY}',
|
stripePublicKey: '',
|
||||||
version: `v${require('../../../../package.json').version}`
|
version: `v${require('../../../../package.json').version}`
|
||||||
};
|
};
|
||||||
|
@ -1,16 +1,33 @@
|
|||||||
import { enableProdMode } from '@angular/core';
|
import { enableProdMode } from '@angular/core';
|
||||||
import { LOCALE_ID } from '@angular/core';
|
import { LOCALE_ID } from '@angular/core';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
import { InfoItem } from '@ghostfolio/common/interfaces';
|
||||||
|
import { permissions } from '@ghostfolio/common/permissions';
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from './app/app.module';
|
||||||
import { environment } from './environments/environment';
|
import { environment } from './environments/environment';
|
||||||
|
|
||||||
if (environment.production) {
|
(async () => {
|
||||||
enableProdMode();
|
const response = await fetch('/api/info');
|
||||||
}
|
const info: InfoItem = await response.json();
|
||||||
|
|
||||||
platformBrowserDynamic()
|
if (window.localStorage.getItem('utm_source') === 'trusted-web-activity') {
|
||||||
.bootstrapModule(AppModule, {
|
info.globalPermissions = info.globalPermissions.filter(
|
||||||
providers: [{ provide: LOCALE_ID, useValue: 'de-CH' }]
|
(permission) => permission !== permissions.enableSubscription
|
||||||
})
|
);
|
||||||
.catch((err) => console.error(err));
|
}
|
||||||
|
|
||||||
|
(window as any).info = info;
|
||||||
|
|
||||||
|
environment.stripePublicKey = info.stripePublicKey;
|
||||||
|
|
||||||
|
if (environment.production) {
|
||||||
|
enableProdMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
platformBrowserDynamic()
|
||||||
|
.bootstrapModule(AppModule, {
|
||||||
|
providers: [{ provide: LOCALE_ID, useValue: 'de-CH' }]
|
||||||
|
})
|
||||||
|
.catch((err) => console.error(err));
|
||||||
|
})();
|
||||||
|
Loading…
Reference in new issue