Skip to content

Commit

Permalink
chore: add SERVER_HOST env
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Apr 8, 2024
1 parent 69b6b39 commit 9ac38d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const envSchema = z.object({
LOKI_URL: z.string().url().trim(),
TOKEN_CACHE_MS: z.coerce.number().optional().default(1_000 * 60 * 5),
SERVER_PORT: z.coerce.number().optional().default(0),
SERVER_HOST: z.string().optional(),
SERVER_SSL_ENABLED: z.boolean().optional().default(false),
SERVER_SSL_CERT: z.string().optional(),
SERVER_SSL_KEY: z.string().optional(),
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ const server = buildServer(serverOptions, {
store
});

server.listen({ port: env.SERVER_PORT }, function httpListeningCallback(err: Error, addr: string) {
server.listen({
port: env.SERVER_PORT,
host: env.SERVER_HOST
}, function httpListeningCallback(err: Error, addr: string) {
if (err) {
server.log.error(err);
process.exit(1);
Expand Down
1 change: 1 addition & 0 deletions src/modules/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const envSchema = z.object({
LOKI_URL: z.string().url().trim(),
TOKEN_CACHE_MS: z.coerce.number().optional().default(1_000 * 60 * 5),
SERVER_PORT: z.coerce.number().optional().default(0),
SERVER_HOST: z.string().optional(),
SERVER_SSL_ENABLED: z.coerce.boolean().optional().default(false),
SERVER_SSL_CERT: z.string().optional(),
SERVER_SSL_KEY: z.string().optional(),
Expand Down

0 comments on commit 9ac38d8

Please sign in to comment.