Add configurable mode option for development/production
Some checks failed
nix-bitcoin tests / build_test_drivers (push) Has been cancelled
nix-bitcoin tests / check_flake (push) Has been cancelled
nix-bitcoin tests / test_scenario (default) (push) Has been cancelled
nix-bitcoin tests / test_scenario (joinmarket-bitcoind-29) (push) Has been cancelled
nix-bitcoin tests / test_scenario (netns) (push) Has been cancelled
nix-bitcoin tests / test_scenario (netnsRegtest) (push) Has been cancelled

- Add services.lamassu-server.mode option (default: development)
- NODE_ENV is now set based on mode in all services
- Development mode uses port 3001 for admin UI registration URLs
- Production mode uses standard HTTPS port (443)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Patrick Mulligan 2026-01-11 18:46:07 +01:00
parent 501d53b238
commit 6a69fe4672

View file

@ -9,7 +9,7 @@ let
# Shared environment variables for both services
commonEnv = {
NODE_ENV = "production";
NODE_ENV = cfg.mode;
LOG_LEVEL = cfg.logLevel;
HOSTNAME = cfg.hostname;
@ -117,6 +117,15 @@ in
description = "Logging level for lamassu-server";
};
mode = mkOption {
type = types.enum [ "production" "development" ];
default = "development";
description = ''
Run in production or development mode.
Development mode uses port 3001 for admin UI registration URLs.
'';
};
skip2FA = mkOption {
type = types.bool;
default = true;
@ -402,6 +411,7 @@ in
export POSTGRES_HOST="127.0.0.1" POSTGRES_PORT="5432"
export POSTGRES_DB="${cfg.database.name}" POSTGRES_USER="${cfg.database.user}" POSTGRES_PASSWORD="$DB_PASSWORD"
export HOSTNAME="${cfg.hostname}" SKIP_2FA="${if cfg.skip2FA then "true" else "false"}"
export NODE_ENV="${cfg.mode}"
sudo -E -u ${cfg.user} ${pkgs.nodejs_22}/bin/node ${cfg.dataDir}/source/packages/server/bin/lamassu-register "$@"
'')
];