Compare commits

..

2 commits

Author SHA1 Message Date
Patrick Mulligan
6a69fe4672 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>
2026-01-11 18:46:07 +01:00
Patrick Mulligan
501d53b238 Fix node-gyp build: add PrivateTmp to lamassu-build service 2026-01-11 18:31:49 +01:00

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;
@ -270,6 +279,8 @@ in
CI = "true";
CC = "${pkgs.stdenv.cc}/bin/cc";
CXX = "${pkgs.stdenv.cc}/bin/c++";
# Use content-addressable store to reduce disk usage
npm_config_cache = "${cfg.dataDir}/.npm-cache";
};
serviceConfig = {
@ -285,6 +296,8 @@ in
ProtectHome = true;
NoNewPrivileges = true;
ReadWritePaths = [ cfg.dataDir ];
# node-gyp needs writable /tmp for native module compilation
PrivateTmp = true;
};
script = ''
@ -398,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 "$@"
'')
];