electrs: add option 'address'
This commit is contained in:
parent
1e62456ed1
commit
e731d71232
@ -34,6 +34,11 @@ in {
|
|||||||
If enabled, the electrs service will sync faster on high-memory systems (≥ 8GB).
|
If enabled, the electrs service will sync faster on high-memory systems (≥ 8GB).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
address = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "127.0.0.1";
|
||||||
|
description = "RPC listening address.";
|
||||||
|
};
|
||||||
port = mkOption {
|
port = mkOption {
|
||||||
type = types.ints.u16;
|
type = types.ints.u16;
|
||||||
default = 50001;
|
default = 50001;
|
||||||
@ -76,7 +81,7 @@ in {
|
|||||||
${pkgs.nix-bitcoin.electrs}/bin/electrs -vvv \
|
${pkgs.nix-bitcoin.electrs}/bin/electrs -vvv \
|
||||||
${optionalString (!cfg.high-memory) "--jsonrpc-import --index-batch-size=10"} \
|
${optionalString (!cfg.high-memory) "--jsonrpc-import --index-batch-size=10"} \
|
||||||
--db-dir '${cfg.dataDir}' --daemon-dir '${config.services.bitcoind.dataDir}' \
|
--db-dir '${cfg.dataDir}' --daemon-dir '${config.services.bitcoind.dataDir}' \
|
||||||
--electrum-rpc-addr=127.0.0.1:${toString cfg.port}
|
--electrum-rpc-addr=${toString cfg.address}:${toString cfg.port}
|
||||||
'';
|
'';
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
@ -101,10 +106,18 @@ in {
|
|||||||
(mkIf cfg.TLSProxy.enable {
|
(mkIf cfg.TLSProxy.enable {
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
appendConfig = ''
|
appendConfig = let
|
||||||
|
address =
|
||||||
|
if cfg.address == "0.0.0.0" then
|
||||||
|
"127.0.0.1"
|
||||||
|
else if cfg.address == "::" then
|
||||||
|
"::1"
|
||||||
|
else
|
||||||
|
cfg.address;
|
||||||
|
in ''
|
||||||
stream {
|
stream {
|
||||||
upstream electrs {
|
upstream electrs {
|
||||||
server 127.0.0.1:${toString cfg.port};
|
server ${address}:${toString cfg.port};
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
Loading…
Reference in New Issue
Block a user