Skip to content

Commit

Permalink
Ensure prod app can run
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Dec 30, 2021
1 parent ec86d54 commit 98cf134
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import { flushCaches } from './cache';
import { registerAuthProviders } from './auth';
import { Url } from './utils/url';
import { getConfigFromEnv } from './utils/get-config-from-env';
import { merge } from 'lodash';

export default async function createApp(): Promise<express.Application> {
validateEnv(['KEY', 'SECRET']);
Expand Down Expand Up @@ -91,7 +92,20 @@ export default async function createApp(): Promise<express.Application> {
app.set('trust proxy', env.IP_TRUST_PROXY);
app.set('query parser', (str: string) => qs.parse(str, { depth: 10 }));

app.use(helmet.contentSecurityPolicy(getConfigFromEnv('CONTENT_SECURITY_POLICY_')));
app.use(
helmet.contentSecurityPolicy(
merge(
{
useDefaults: true,
directives: {
// Unsafe-eval is required for vue3 / vue-i18n / app extensions
scriptSrc: ["'self'", "'unsafe-eval'"],
},
},
getConfigFromEnv('CONTENT_SECURITY_POLICY_')
)
)
);

await emitter.emitInit('app.before', { app });

Expand Down

0 comments on commit 98cf134

Please sign in to comment.