Skip to content

Make codedb serve port configurable via CODEDB_PORT env var #308

@justrach

Description

@justrach

Summary

codedb serve currently hardcodes port 7719 (src/main.zig). This blocks a few reasonable local setups:

  • Running multiple codedb instances on one host (one per project)
  • Putting the server behind a reverse proxy or dev container that wants a different listen port
  • Avoiding collisions when 7719 is already taken by another tool
  • Integration tests that want an ephemeral port

Proposal

Read CODEDB_PORT from the environment, parse as u16, fall back to 7719 on absence or parse failure. Zero code-path changes for existing users — the default stays the same.

const port: u16 = blk: {
    const raw = cio.posixGetenv("CODEDB_PORT") orelse break :blk 7719;
    break :blk std.fmt.parseInt(u16, raw, 10) catch 7719;
};

Scope

  • src/main.zig — one block inside the cmd == "serve" branch
  • Docs note (README / --help usage) optional but nice

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions