Skip to content

Commit 641122c

Browse files
nixos/neo4j: add advertisedAddress options (NixOS#364250)
2 parents 85b9a68 + 59ebd72 commit 641122c

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

nixos/modules/services/databases/neo4j.nix

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ let
6161
# HTTP Connector
6262
server.http.enabled=${lib.boolToString cfg.http.enable}
6363
server.http.listen_address=${cfg.http.listenAddress}
64-
server.http.advertised_address=${cfg.http.listenAddress}
64+
server.http.advertised_address=${cfg.http.advertisedAddress}
6565
6666
# HTTPS Connector
6767
server.https.enabled=${lib.boolToString cfg.https.enable}
6868
server.https.listen_address=${cfg.https.listenAddress}
69-
server.https.advertised_address=${cfg.https.listenAddress}
69+
server.https.advertised_address=${cfg.https.advertisedAddress}
7070
7171
# BOLT Connector
7272
server.bolt.enabled=${lib.boolToString cfg.bolt.enable}
7373
server.bolt.listen_address=${cfg.bolt.listenAddress}
74-
server.bolt.advertised_address=${cfg.bolt.listenAddress}
74+
server.bolt.advertised_address=${cfg.bolt.advertisedAddress}
7575
server.bolt.tls_level=${cfg.bolt.tlsLevel}
7676
7777
# SSL Policies
@@ -99,10 +99,8 @@ let
9999
# Extra Configuration
100100
${cfg.extraServerConfig}
101101
'';
102-
103102
in
104103
{
105-
106104
imports = [
107105
(lib.mkRenamedOptionModule
108106
[ "services" "neo4j" "host" ]
@@ -160,7 +158,6 @@ in
160158
###### interface
161159

162160
options.services.neo4j = {
163-
164161
enable = lib.mkOption {
165162
type = lib.types.bool;
166163
default = false;
@@ -248,6 +245,16 @@ in
248245
'';
249246
};
250247

248+
advertisedAddress = lib.mkOption {
249+
type = lib.types.str;
250+
default = cfg.bolt.listenAddress;
251+
defaultText = lib.literalExpression "config.${opt.bolt.listenAddress}";
252+
description = ''
253+
Neo4j advertised address for BOLT traffic. The advertised address is
254+
expressed in the format `<ip-address>:<port-number>`.
255+
'';
256+
};
257+
251258
sslPolicy = lib.mkOption {
252259
type = lib.types.str;
253260
default = "legacy";
@@ -379,6 +386,16 @@ in
379386
expressed in the format `<ip-address>:<port-number>`.
380387
'';
381388
};
389+
390+
advertisedAddress = lib.mkOption {
391+
type = lib.types.str;
392+
default = cfg.http.listenAddress;
393+
defaultText = lib.literalExpression "config.${opt.http.listenAddress}";
394+
description = ''
395+
Neo4j advertised address for HTTP traffic. The advertised address is
396+
expressed in the format `<ip-address>:<port-number>`.
397+
'';
398+
};
382399
};
383400

384401
https = {
@@ -401,6 +418,16 @@ in
401418
'';
402419
};
403420

421+
advertisedAddress = lib.mkOption {
422+
type = lib.types.str;
423+
default = cfg.https.listenAddress;
424+
defaultText = lib.literalExpression "config.${opt.https.listenAddress}";
425+
description = ''
426+
Neo4j advertised address for HTTPS traffic. The advertised address is
427+
expressed in the format `<ip-address>:<port-number>`.
428+
'';
429+
};
430+
404431
sslPolicy = lib.mkOption {
405432
type = lib.types.str;
406433
default = "legacy";
@@ -440,7 +467,6 @@ in
440467
}:
441468
{
442469
options = {
443-
444470
allowKeyGeneration = lib.mkOption {
445471
type = lib.types.bool;
446472
default = false;
@@ -590,13 +616,11 @@ in
590616
default value.
591617
'';
592618
};
593-
594619
};
595620

596621
config.directoriesToCreate = lib.optionals (
597622
certDirOpt.highestPrio >= 1500 && options.baseDirectory.highestPrio >= 1500
598623
) (map (opt: opt.value) (lib.filter isDefaultPathOption (lib.attrValues options)));
599-
600624
}
601625
)
602626
);
@@ -610,7 +634,6 @@ in
610634
for further details.
611635
'';
612636
};
613-
614637
};
615638

616639
###### implementation
@@ -630,7 +653,6 @@ in
630653
lib.attrValues cfg.ssl.policies
631654
);
632655
in
633-
634656
lib.mkIf cfg.enable {
635657
assertions = [
636658
{

0 commit comments

Comments
 (0)