Browse Source

feat(server): Add hostname config option

Michael Bromley 7 years ago
parent
commit
70e2fb45a9

+ 1 - 1
server/src/bootstrap.ts

@@ -28,7 +28,7 @@ export async function bootstrap(userConfig: Partial<VendureConfig>): Promise<INe
     });
 
     await runPluginOnBootstrapMethods(config, app);
-    await app.listen(config.port);
+    await app.listen(config.port, config.hostname);
     return app;
 }
 

+ 1 - 0
server/src/config/default-config.ts

@@ -23,6 +23,7 @@ export const defaultConfig: ReadOnlyRequired<VendureConfig> = {
     channelTokenKey: 'vendure-token',
     defaultChannelToken: null,
     defaultLanguageCode: LanguageCode.en,
+    hostname: '',
     port: API_PORT,
     cors: {
         origin: true,

+ 4 - 0
server/src/config/vendure-config.ts

@@ -214,6 +214,10 @@ export interface VendureConfig {
      * Set the CORS handling for the server.
      */
     cors?: boolean | CorsOptions;
+    /**
+     * Set the hostname of the server.
+     */
+    hostname?: string;
     /**
      * Which port the Vendure server should listen on.
      */