mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-20 20:20:26 +03:00
nixos/cockroachdb: use escapeSystemdExecArgs
for ExecStart args
Co-authored-by: pennae <82953136+pennae@users.noreply.github.com>
This commit is contained in:
parent
d215163ff9
commit
dccd5a44d1
@ -1,4 +1,4 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, utils, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
@ -6,47 +6,44 @@ let
|
|||||||
cfg = config.services.cockroachdb;
|
cfg = config.services.cockroachdb;
|
||||||
crdb = cfg.package;
|
crdb = cfg.package;
|
||||||
|
|
||||||
escape = builtins.replaceStrings ["%"] ["%%"];
|
startupCommand = utils.escapeSystemdExecArgs
|
||||||
ifNotNull = v: s: optionalString (v != null) s;
|
|
||||||
|
|
||||||
startupCommand = lib.concatStringsSep " "
|
|
||||||
([
|
([
|
||||||
# Basic startup
|
# Basic startup
|
||||||
"${crdb}/bin/cockroach start"
|
"${crdb}/bin/cockroach"
|
||||||
|
"start"
|
||||||
"--logtostderr"
|
"--logtostderr"
|
||||||
"--store=/var/lib/cockroachdb"
|
"--store=/var/lib/cockroachdb"
|
||||||
(ifNotNull cfg.locality "--locality='${cfg.locality}'")
|
|
||||||
|
|
||||||
# WebUI settings
|
# WebUI settings
|
||||||
"--http-addr='${cfg.http.address}:${toString cfg.http.port}'"
|
"--http-addr=${cfg.http.address}:${toString cfg.http.port}"
|
||||||
|
|
||||||
# Cluster listen address
|
# Cluster listen address
|
||||||
"--listen-addr='${cfg.listen.address}:${toString cfg.listen.port}'"
|
"--listen-addr=${cfg.listen.address}:${toString cfg.listen.port}"
|
||||||
|
|
||||||
# Cluster configuration
|
# Cache and memory settings.
|
||||||
(ifNotNull cfg.join "--join=${cfg.join}")
|
"--cache=${cfg.cache}"
|
||||||
|
"--max-sql-memory=${cfg.maxSqlMemory}"
|
||||||
# Cache and memory settings. Must be escaped.
|
|
||||||
"--cache='${escape cfg.cache}'"
|
|
||||||
"--max-sql-memory='${escape cfg.maxSqlMemory}'"
|
|
||||||
|
|
||||||
# Certificate/security settings.
|
# Certificate/security settings.
|
||||||
(if cfg.insecure then "--insecure" else "--certs-dir=${cfg.certsDir}")
|
(if cfg.insecure then "--insecure" else "--certs-dir=${cfg.certsDir}")
|
||||||
] ++ cfg.extraArgs);
|
]
|
||||||
|
++ lib.optional (cfg.join != null) "--join=${cfg.join}"
|
||||||
|
++ lib.optional (cfg.locality != null) "--locality=${cfg.locality}"
|
||||||
|
++ cfg.extraArgs);
|
||||||
|
|
||||||
addressOption = descr: defaultPort: {
|
addressOption = descr: defaultPort: {
|
||||||
address = mkOption {
|
address = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "localhost";
|
default = "localhost";
|
||||||
description = "Address to bind to for ${descr}";
|
description = "Address to bind to for ${descr}";
|
||||||
};
|
|
||||||
|
|
||||||
port = mkOption {
|
|
||||||
type = types.port;
|
|
||||||
default = defaultPort;
|
|
||||||
description = "Port to bind to for ${descr}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = defaultPort;
|
||||||
|
description = "Port to bind to for ${descr}";
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user