From 41a926106941077ebfc121359923bea1824f73fe Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 20 Oct 2021 15:42:15 +0300 Subject: [PATCH] [#935] config/example: quote spaces in `node.env` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` > source config/example/node.env config/example/node.env: строка 14: /dns4/s02.neofs.devenv/tcp/8081: Нет такого файла или каталога config/example/node.env: строка 16: MSK: команда не найдена config/example/node.env: строка 35: 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6: команда не найдена config/example/node.env: строка 48: https://rpc2.morph.fs.neo.org:40341: Нет такого файла или каталога config/example/node.env: строка 49: wss://rpc2.morph.fs.neo.org:40341/ws: Нет такого файла или каталога config/example/node.env: строка 53: https://rpc2.n3.nspcc.ru:30341: Нет такого файла или каталога ``` New implementation is still basic, but we don't need to parse any env file, just have a correct example. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-node/config/test/config.go | 4 +++- config/example/node.env | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/neofs-node/config/test/config.go b/cmd/neofs-node/config/test/config.go index 410ea57e8..947a437d9 100644 --- a/cmd/neofs-node/config/test/config.go +++ b/cmd/neofs-node/config/test/config.go @@ -65,11 +65,13 @@ func loadEnv(path string) { scanner := bufio.NewScanner(f) for scanner.Scan() { - pair := strings.Split(scanner.Text(), "=") + pair := strings.SplitN(scanner.Text(), "=", 2) if len(pair) != 2 { continue } + pair[1] = strings.Trim(pair[1], `"`) + err = os.Setenv(pair[0], pair[1]) if err != nil { panic("can't set environment variable") diff --git a/config/example/node.env b/config/example/node.env index ed83fa41d..2edbc69ca 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -11,9 +11,9 @@ NEOFS_NODE_KEY=./wallet.key NEOFS_NODE_WALLET_PATH=./wallet.json NEOFS_NODE_WALLET_ADDRESS=NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz NEOFS_NODE_WALLET_PASSWORD=password -NEOFS_NODE_ADDRESSES=s01.neofs.devenv:8080 /dns4/s02.neofs.devenv/tcp/8081 grpc://127.0.0.1:8082 grpcs://localhost:8083 +NEOFS_NODE_ADDRESSES="s01.neofs.devenv:8080 /dns4/s02.neofs.devenv/tcp/8081 grpc://127.0.0.1:8082 grpcs://localhost:8083" NEOFS_NODE_ATTRIBUTE_0=Price:11 -NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU MSK +NEOFS_NODE_ATTRIBUTE_1="UN-LOCODE:RU MSK" NEOFS_NODE_RELAY=true NEOFS_NODE_PERSISTENT_STATE_PATH=/state @@ -32,7 +32,7 @@ NEOFS_GRPC_1_ENDPOINT=s02.neofs.devenv:8080 NEOFS_GRPC_1_TLS_ENABLED=false # Control service section -NEOFS_CONTROL_AUTHORIZED_KEYS=035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6 +NEOFS_CONTROL_AUTHORIZED_KEYS="035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6" NEOFS_CONTROL_GRPC_ENDPOINT=127.0.0.1:8090 # Contracts section @@ -45,12 +45,12 @@ NEOFS_CONTRACTS_PROXY=ad7c6b55b737b696e5c82c85445040964a03e97f # Morph chain section NEOFS_MORPH_DIAL_TIMEOUT=30s NEOFS_MORPH_DISABLE_CACHE=true -NEOFS_MORPH_RPC_ENDPOINT=https://rpc1.morph.fs.neo.org:40341 https://rpc2.morph.fs.neo.org:40341 -NEOFS_MORPH_NOTIFICATION_ENDPOINT=wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws +NEOFS_MORPH_RPC_ENDPOINT="https://rpc1.morph.fs.neo.org:40341 https://rpc2.morph.fs.neo.org:40341" +NEOFS_MORPH_NOTIFICATION_ENDPOINT="wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws" # Main chain section (optional) NEOFS_MAINCHAIN_DIAL_TIMEOUT=30s -NEOFS_MAINCHAIN_RPC_ENDPOINT=https://rpc1.n3.nspcc.ru:30341 https://rpc2.n3.nspcc.ru:30341 +NEOFS_MAINCHAIN_RPC_ENDPOINT="https://rpc1.n3.nspcc.ru:30341 https://rpc2.n3.nspcc.ru:30341" # API Client section NEOFS_APICLIENT_DIAL_TIMEOUT=15s