add dbUrl
This commit is contained in:
parent
748f956361
commit
d6db331166
1 changed files with 15 additions and 1 deletions
16
flake.nix
16
flake.nix
|
|
@ -69,6 +69,18 @@
|
|||
description = "The phoenix package containing the application";
|
||||
};
|
||||
|
||||
secret_key_file = mkOption {
|
||||
type = types.string;
|
||||
example = "/var/lib/skey";
|
||||
description = "The Secrert key for Phoenix";
|
||||
};
|
||||
|
||||
dbUrl = mkOption {
|
||||
type = types.string;
|
||||
default = "postgresql://${config.services.postgres.user}:${config.services.postgres.password}@${config.services.postgres.host}:${toString config.services.postgres.port}/zoeyscomputer_prod";
|
||||
description = "Postgres Databaase URL";
|
||||
};
|
||||
|
||||
enableServer = mkOption rec {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
|
|
@ -105,6 +117,7 @@
|
|||
PORT = "${toString cfg.phx.port}";
|
||||
PHX_HOST = cfg.domain;
|
||||
PHX_SERVER = toString cfg.phx.enableServer;
|
||||
DATABASE_URL = cfg.phx.dbUrl;
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "exec";
|
||||
|
|
@ -113,6 +126,7 @@
|
|||
# Implied by DynamicUser, but just to emphasize due to RELEASE_TMP
|
||||
PrivateTmp = true;
|
||||
ExecStart = pkgs.writeShellScript "start-zoeycomputer" ''
|
||||
export SECRET_KEY_BASE=$(cat ${cfg.phx.secret_key_file})
|
||||
${cfg.phx.package}/bin/${release_name} eval "ZoeysComputer.Release.migrate"
|
||||
${cfg.phx.package}/bin/${release_name} start
|
||||
'';
|
||||
|
|
@ -128,7 +142,7 @@
|
|||
StartLimitInterval = 10;
|
||||
};
|
||||
# disksup requires bash
|
||||
path = [pkgs.bash];
|
||||
path = [pkgs.bash pkgs.coreutils];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue