Parcourir la source

refactor(core): Move default authTokenHeaderKey into shared constant

Michael Bromley il y a 6 ans
Parent
commit
574d70b28e

+ 1 - 0
packages/common/src/shared-constants.ts

@@ -13,6 +13,7 @@ export const SUPER_ADMIN_USER_PASSWORD = 'superadmin';
 export const CUSTOMER_ROLE_CODE = '__customer_role__';
 export const CUSTOMER_ROLE_DESCRIPTION = 'Customer';
 export const ROOT_COLLECTION_NAME = '__root_collection__';
+export const DEFAULT_AUTH_TOKEN_HEADER_KEY = 'vendure-auth-token';
 
 // An environment variable which is set when the @vendure/create
 // script is run. Can be used to modify normal behaviour

+ 2 - 1
packages/core/src/config/default-config.ts

@@ -1,5 +1,6 @@
 import { Transport } from '@nestjs/microservices';
 import { LanguageCode } from '@vendure/common/lib/generated-types';
+import { DEFAULT_AUTH_TOKEN_HEADER_KEY } from '@vendure/common/lib/shared-constants';
 
 import { ReadOnlyRequired } from '../common/types/common-types';
 
@@ -38,7 +39,7 @@ export const defaultConfig: ReadOnlyRequired<VendureConfig> = {
         disableAuth: false,
         tokenMethod: 'cookie',
         sessionSecret: 'session-secret',
-        authTokenHeaderKey: 'vendure-auth-token',
+        authTokenHeaderKey: DEFAULT_AUTH_TOKEN_HEADER_KEY,
         sessionDuration: '7d',
         requireVerification: true,
         verificationTokenDuration: '7d',