Skip to content

Commit

Permalink
deprecate --addr in favor of --host
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci committed Oct 30, 2024
1 parent 1b886f6 commit d5bf235
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/chopsticks/src/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export const zHex = z.custom<HexString>((val: any) => /^0x\w+$/.test(val))
export const zHash = z.string().length(66).and(zHex)

export const configSchema = z.object({
addr: z
.union([z.literal('localhost'), z.string().ip()], {
description: '[DEPRECATED] Use --host instead',
})
.optional(),
host: z
.union([z.literal('localhost'), z.string().ip()], {
description: 'Server listening interface',
Expand Down
4 changes: 4 additions & 0 deletions packages/chopsticks/src/setup-with-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { handler } from './rpc/index.js'
import { setupContext } from './context.js'

export const setupWithServer = async (argv: Config) => {
if (argv.addr) {
defaultLogger.warn({}, `⚠️ Option --addr is deprecated, please use --host instead.`)
argv.host ??= argv.addr
}
const context = await setupContext(argv)

const { close, addr } = await createServer(handler(context), argv.port, argv.host)
Expand Down

0 comments on commit d5bf235

Please sign in to comment.