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 = {
|
||||
lastPublish: '{BUILD_TIMESTAMP}',
|
||||
production: true,
|
||||
stripePublicKey: '{STRIPE_PUBLIC_KEY}',
|
||||
stripePublicKey: '',
|
||||
version: `v${require('../../../../package.json').version}`
|
||||
};
|
||||
|
@ -1,16 +1,33 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { LOCALE_ID } from '@angular/core';
|
||||
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 { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
(async () => {
|
||||
const response = await fetch('/api/info');
|
||||
const info: InfoItem = await response.json();
|
||||
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(AppModule, {
|
||||
providers: [{ provide: LOCALE_ID, useValue: 'de-CH' }]
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
if (window.localStorage.getItem('utm_source') === 'trusted-web-activity') {
|
||||
info.globalPermissions = info.globalPermissions.filter(
|
||||
(permission) => permission !== permissions.enableSubscription
|
||||
);
|
||||
}
|
||||
|
||||
(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