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:
Sarah Brofeldt 2018-05-24 10:53:49 +02:00 committed by GitHub
commit e27a4502cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -186,6 +186,14 @@ in {
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 {
type = types.nullOr types.int;
default = null;
@ -232,7 +240,13 @@ in {
'';
script = ''
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
'';