Compare commits
2 commits
4fd0a02f81
...
6a69fe4672
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a69fe4672 | ||
|
|
501d53b238 |
1 changed files with 15 additions and 1 deletions
|
|
@ -9,7 +9,7 @@ let
|
||||||
|
|
||||||
# Shared environment variables for both services
|
# Shared environment variables for both services
|
||||||
commonEnv = {
|
commonEnv = {
|
||||||
NODE_ENV = "production";
|
NODE_ENV = cfg.mode;
|
||||||
LOG_LEVEL = cfg.logLevel;
|
LOG_LEVEL = cfg.logLevel;
|
||||||
HOSTNAME = cfg.hostname;
|
HOSTNAME = cfg.hostname;
|
||||||
|
|
||||||
|
|
@ -117,6 +117,15 @@ in
|
||||||
description = "Logging level for lamassu-server";
|
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 {
|
skip2FA = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
|
@ -270,6 +279,8 @@ in
|
||||||
CI = "true";
|
CI = "true";
|
||||||
CC = "${pkgs.stdenv.cc}/bin/cc";
|
CC = "${pkgs.stdenv.cc}/bin/cc";
|
||||||
CXX = "${pkgs.stdenv.cc}/bin/c++";
|
CXX = "${pkgs.stdenv.cc}/bin/c++";
|
||||||
|
# Use content-addressable store to reduce disk usage
|
||||||
|
npm_config_cache = "${cfg.dataDir}/.npm-cache";
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
|
@ -285,6 +296,8 @@ in
|
||||||
ProtectHome = true;
|
ProtectHome = true;
|
||||||
NoNewPrivileges = true;
|
NoNewPrivileges = true;
|
||||||
ReadWritePaths = [ cfg.dataDir ];
|
ReadWritePaths = [ cfg.dataDir ];
|
||||||
|
# node-gyp needs writable /tmp for native module compilation
|
||||||
|
PrivateTmp = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
|
|
@ -398,6 +411,7 @@ in
|
||||||
export POSTGRES_HOST="127.0.0.1" POSTGRES_PORT="5432"
|
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 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 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 "$@"
|
sudo -E -u ${cfg.user} ${pkgs.nodejs_22}/bin/node ${cfg.dataDir}/source/packages/server/bin/lamassu-register "$@"
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue