nixos/ipfs: Improve behavior of localDiscovery option
It is no longer required to change the config your ipfs repo manually if you change localDiscovery option in nixos configuration after ipfs repository initialization.
This commit is contained in:
parent
1bf798b8cb
commit
2009c76a66
@ -189,9 +189,7 @@ in {
|
|||||||
localDiscovery = mkOption {
|
localDiscovery = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = ''Whether to enable local discovery for the ipfs daemon.
|
description = ''Whether to enable local discovery for the ipfs daemon.
|
||||||
This will prevent ipfs to scan ports on your local network. Some hosting services will ban you if you do.
|
This will allow ipfs to scan ports on your local network. Some hosting services will ban you if you do this.
|
||||||
|
|
||||||
This option only has an effect before you initialized ipfs your machine.
|
|
||||||
'';
|
'';
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
@ -244,6 +242,11 @@ in {
|
|||||||
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"}
|
${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
Block a user