From f7f1d74f622dc604c60ab30bd0fde41f8b8fb98d Mon Sep 17 00:00:00 2001 From: Valentin Date: Thu, 5 Aug 2021 10:08:14 +0200 Subject: [PATCH 1/2] Document config initialization with envs Documentation of feature from https://github.com/ipfs/go-ipfs/pull/8326 --- docs/how-to/run-ipfs-inside-docker.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/how-to/run-ipfs-inside-docker.md b/docs/how-to/run-ipfs-inside-docker.md index 173f2c85e..6a35dcb19 100644 --- a/docs/how-to/run-ipfs-inside-docker.md +++ b/docs/how-to/run-ipfs-inside-docker.md @@ -64,6 +64,20 @@ When starting a container running ipfs for the first time with an empty data dir ```shell docker run -d --name ipfs_host -e IPFS_PROFILE=server -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest ``` +## Environmet override +You can override the default configuration during the *first* initialization with variables starting with **IPFCONFIG** and *_* as separators, which will be passed directly to `ipfs config` + +For example: +```shell +docker run --rm -e IPFSCONFIG_Swarm_EnableAutoRelay=true -e IPFSCONFIG_Addresses_Swarm=[\"/ip4/0.0.0.0/tcp/4002\",\"/ip6/::/tcp/4002\"] ipfs/go-ipfs:latest +``` + +Some important notes: + - The names are case sensitive. `IPFSCONFIG_FooBar=true` and `IPFSCONFIG_foobar=true` are not the same + - Arrays must use escaped double quotes, like `IPFSCONFIG_FooBar=[\"test\"]` + - Syntactically valid config will **not** cause any error, even if it does anything. `IPFSCONFIG_zzz_abcds=true` wil be written to the config + - Invalid variables will be ignored, like `IPFSCONFIG_foobar_=true` + - Invalid values will faill initialization, like `IPFSCONFIG_foobar=trues` ## Private swarms inside Docker From 2765add9489267c3f5d7ec74123b27aa095193fb Mon Sep 17 00:00:00 2001 From: Johnny <9611008+johnnymatthews@users.noreply.github.com> Date: Thu, 5 Aug 2021 10:46:38 -0300 Subject: [PATCH 2/2] Apply suggestions from code review --- docs/how-to/run-ipfs-inside-docker.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/how-to/run-ipfs-inside-docker.md b/docs/how-to/run-ipfs-inside-docker.md index 6a35dcb19..149db25a4 100644 --- a/docs/how-to/run-ipfs-inside-docker.md +++ b/docs/how-to/run-ipfs-inside-docker.md @@ -65,19 +65,25 @@ When starting a container running ipfs for the first time with an empty data dir docker run -d --name ipfs_host -e IPFS_PROFILE=server -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest ``` ## Environmet override -You can override the default configuration during the *first* initialization with variables starting with **IPFCONFIG** and *_* as separators, which will be passed directly to `ipfs config` -For example: +You can override the default configuration during the first initialization with variables starting with `IPFCONFIG` and `_` as separators. These variables are passed directly to `ipfs config`: + ```shell docker run --rm -e IPFSCONFIG_Swarm_EnableAutoRelay=true -e IPFSCONFIG_Addresses_Swarm=[\"/ip4/0.0.0.0/tcp/4002\",\"/ip6/::/tcp/4002\"] ipfs/go-ipfs:latest ``` -Some important notes: - - The names are case sensitive. `IPFSCONFIG_FooBar=true` and `IPFSCONFIG_foobar=true` are not the same - - Arrays must use escaped double quotes, like `IPFSCONFIG_FooBar=[\"test\"]` - - Syntactically valid config will **not** cause any error, even if it does anything. `IPFSCONFIG_zzz_abcds=true` wil be written to the config - - Invalid variables will be ignored, like `IPFSCONFIG_foobar_=true` - - Invalid values will faill initialization, like `IPFSCONFIG_foobar=trues` +Configuration variables must follow these rules: + +- The names are case sensitive. `IPFSCONFIG_saturn=true` and `IPFS_CONFIG_Saturn=true` are not the same, so adding both to the configuration file will create two separate variables. +- Arrays must use escaped double quotes: + + ```shell + IPFSCONFIG_FooBar=[\"test\"] + ``` + +- Syntactically valid config will **not** cause any errors. + - Invalid variables will be ignored. For example, `IPFSCONFIG_pluto_=true` will _not_ create a `pluto_` variable. + - Invalid values will fail initialization. For example, `IPFSCONFIG_foobar=trues` will cause IPFS to output an error. ## Private swarms inside Docker