Merge pull request #40879 from seppeljordan/pr-ipfs-port-scanning
nixos/ipfs: Add option to disable local port scanning for ipfs daemon
This commit is contained in:
commit
e27a4502cb
|
@ -186,6 +186,14 @@ in {
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
localDiscovery = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = ''Whether to enable local discovery for the ipfs daemon.
|
||||||
|
This will allow ipfs to scan ports on your local network. Some hosting services will ban you if you do this.
|
||||||
|
'';
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
serviceFdlimit = mkOption {
|
serviceFdlimit = mkOption {
|
||||||
type = types.nullOr types.int;
|
type = types.nullOr types.int;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -232,7 +240,13 @@ in {
|
||||||
'';
|
'';
|
||||||
script = ''
|
script = ''
|
||||||
if [[ ! -f ${cfg.dataDir}/config ]]; then
|
if [[ ! -f ${cfg.dataDir}/config ]]; then
|
||||||
ipfs init ${optionalString cfg.emptyRepo "-e"}
|
ipfs init ${optionalString cfg.emptyRepo "-e"} \
|
||||||
|
${optionalString (! cfg.localDiscovery) "--profile=server"}
|
||||||
|
else
|
||||||
|
${if cfg.localDiscovery
|
||||||
|
then "ipfs config profile apply local-discovery"
|
||||||
|
else "ipfs config profile apply server"
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue