diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2025-12-14 23:24:27 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2025-12-15 00:06:20 -0800 |
| commit | 9c9f35734e795e3c2cea21384349b655d7ffa164 (patch) | |
| tree | 66351cc8a4d72f2eabb2a6ec6ee96ed7abbb253f /src/index.ts | |
| parent | 15e37e367c7e30a8b172c5a379791fb3e0b820b8 (diff) | |
| download | posthook-9c9f35734e795e3c2cea21384349b655d7ffa164.tar.gz posthook-9c9f35734e795e3c2cea21384349b655d7ffa164.zip | |
Add cors flags
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts index cbc946a..0ece985 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,12 +7,13 @@ import { TokenSigner } from './token/index.js'; const main = async (_argv = process.argv.slice(2)): Promise<IEither<Error, void>> => { const argsResult = argv( - ['--port', '--host', '--data-dir', '--token-secret'], + ['--port', '--host', '--data-dir', '--token-secret', '--cors-origins'], { '--port': { absent: 9000, present: (port) => parseInt(port) }, '--host': { absent: '0.0.0.0', present: (host) => host }, '--data-dir': { absent: './data', present: (dir) => dir }, '--token-secret': { absent: undefined, present: (secret) => secret }, + '--cors-origins': { absent: '*', present: (origins) => origins }, }, _argv, ); @@ -23,6 +24,7 @@ const main = async (_argv = process.argv.slice(2)): Promise<IEither<Error, void> host: args['--host'], dataDir: args['--data-dir'], tokenSecret: args['--token-secret'], + corsOrigins: args['--cors-origins'], })) .flatMapAsync(async (config) => { // Initialize storage @@ -47,7 +49,7 @@ const main = async (_argv = process.argv.slice(2)): Promise<IEither<Error, void> console.log(`Starting server on ${config.host}:${config.port}`); // Create and start server - const server = new PosthookServer(storage, signer); + const server = new PosthookServer(storage, signer, config.corsOrigins); const hono = new HonoProxy(server); return hono.serve(config.port, config.host); |
