Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toml: use snake_case remove unused properties #3684

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acceptance/brutil/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test_config() {
cp -Lr "acceptance/${TEST_DIR}/conf/." "$TEST_ARTIFACTS_DIR/conf"

# Replace BR ID
sed -i "s/ID = .*$/ID = \"${BRID}\"/g" "$BR_TOML"
sed -i "s/id = .*$/id = \"${BRID}\"/g" "$BR_TOML"
sed -i "s/path = .*$/path = \"\/share\/logs\/${BRID}.log\"/g" "$BR_TOML"
}

Expand Down
4 changes: 2 additions & 2 deletions acceptance/brutil/conf/br.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[general]
ConfigDir = "/share/conf"
ID = <AUTOFILLED>
config_dir = "/share/conf"
id = <AUTOFILLED>

[log.file]
level = "debug"
Expand Down
2 changes: 1 addition & 1 deletion acceptance/brutil/conf/disp.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[dispatcher]
ID = "dispatcher"
id = "dispatcher"

[log.file]
level = "debug"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[dispatcher]
ID = "disp_1-ff00_0_110"
id = "disp_1-ff00_0_110"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[log.file]
level = "trace"
Expand Down
14 changes: 7 additions & 7 deletions acceptance/sig_failover/testdata/1-ff00_0_110/sig/sig.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[sig]
ID = "sig1-ff00_0_110"
SIGConfig = "/cfg.json"
IA = "1-ff00:0:110"
IP = "242.254.100.2"
id = "sig1-ff00_0_110"
sig_config = "/cfg.json"
isd_as = "1-ff00:0:110"
ip = "242.254.100.2"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[sd_client]
FakeData = "/fake_sciond.json"
[sciond_connection]
fake_data = "/fake_sciond.json"

[log.file]
flush_interval = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[dispatcher]
ID = "disp_1-ff00_0_111"
id = "disp_1-ff00_0_111"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[log.file]
level = "trace"
Expand Down
14 changes: 7 additions & 7 deletions acceptance/sig_failover/testdata/1-ff00_0_111/sig/sig.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[sig]
ID = "sig1-ff00_0_111"
SIGConfig = "/cfg.json"
IA = "1-ff00:0:111"
IP = "242.254.200.2"
id = "sig1-ff00_0_111"
sig_config = "/cfg.json"
isd_as = "1-ff00:0:111"
ip = "242.254.200.2"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[sd_client]
FakeData = "/fake_sciond.json"
[sciond_connection]
fake_data = "/fake_sciond.json"

[log.file]
flush_interval = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[dispatcher]
ID = "disp_1-ff00_0_110"
id = "disp_1-ff00_0_110"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[log.file]
level = "trace"
Expand Down
14 changes: 7 additions & 7 deletions acceptance/sig_short_exp_time/testdata/1-ff00_0_110/sig/sig.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[sig]
ID = "sig1-ff00_0_110"
SIGConfig = "/cfg.json"
IA = "1-ff00:0:110"
IP = "242.254.100.2"
id = "sig1-ff00_0_110"
sig_config = "/cfg.json"
isd_as = "1-ff00:0:110"
ip = "242.254.100.2"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[sd_client]
FakeData = "/fake_sciond.json"
[sciond_connection]
fake_data = "/fake_sciond.json"

[log.file]
flush_interval = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[dispatcher]
ID = "disp_1-ff00_0_111"
id = "disp_1-ff00_0_111"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[log.file]
level = "trace"
Expand Down
14 changes: 7 additions & 7 deletions acceptance/sig_short_exp_time/testdata/1-ff00_0_111/sig/sig.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[sig]
ID = "sig1-ff00_0_111"
SIGConfig = "/cfg.json"
IA = "1-ff00:0:111"
IP = "242.254.200.2"
id = "sig1-ff00_0_111"
sig_config = "/cfg.json"
isd_as = "1-ff00:0:111"
ip = "242.254.200.2"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[sd_client]
FakeData = "/fake_sciond.json"
[sciond_connection]
fake_data = "/fake_sciond.json"

[log.file]
flush_interval = 1
Expand Down
2 changes: 0 additions & 2 deletions acceptance/topo_cs_reload/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ container_image(
"-config",
"/disp.toml",
],
stamp = True,
)

container_image(
Expand All @@ -50,7 +49,6 @@ container_image(
"-config",
"/cs.toml",
],
stamp = True,
)

genrule(
Expand Down
23 changes: 10 additions & 13 deletions acceptance/topo_cs_reload/testdata/cs.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
[general]
ReconnectToDispatcher = true
ConfigDir = "/"
ID = "cs1-ff00_0_110-1"
reconnect_to_dispatcher = true
config_dir = "/"
id = "cs1-ff00_0_110-1"

[trustDB]
Connection = "cs1-ff00_0_110-1.trust.db"
Backend = "sqlite"
[trust_db]
connection = "cs1-ff00_0_110-1.trust.db"

[log.console]
level = "trace"

[ps.pathDB]
Connection = "cs1-ff00_0_110-1.path.db"
Backend = "sqlite"
[path_db]
connection = "cs1-ff00_0_110-1.path.db"

[beaconDB]
Backend = "sqlite"
Connection = "cs1-ff00_0_110-1.beacon.db"
[beacon_db]
connection = "cs1-ff00_0_110-1.beacon.db"

[metrics]
Prometheus = "242.253.100.2:30453"
prometheus = "242.253.100.2:30453"
4 changes: 2 additions & 2 deletions acceptance/topo_cs_reload/testdata/disp.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[dispatcher]
ID = "disp_1-ff00_0_110"
id = "disp_1-ff00_0_110"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[log.console]
level = "trace"
18 changes: 8 additions & 10 deletions acceptance/topo_cs_reload/testdata/sd.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
[general]
ReconnectToDispatcher = true
ConfigDir = "/"
ID = "sd1-ff00_0_110"
reconnect_to_dispatcher = true
config_dir = "/"
id = "sd1-ff00_0_110"

[trustDB]
Connection = "sd1-ff00_0_110.trust.db"
Backend = "sqlite"
[trust_db]
connection = "sd1-ff00_0_110.trust.db"

[log.console]
level = "trace"

[sd]
Address = "242.253.100.3:30255"
address = "242.253.100.3:30255"

[sd.pathDB]
Connection = "sd1-ff00_0_110.path.db"
Backend = "sqlite"
[path_db]
connection = "sd1-ff00_0_110.path.db"
2 changes: 0 additions & 2 deletions acceptance/topo_sd_reload/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ container_image(
"-config",
"/disp.toml",
],
stamp = True,
)

container_image(
Expand All @@ -45,5 +44,4 @@ container_image(
"-config",
"/sd.toml",
],
stamp = True,
)
4 changes: 2 additions & 2 deletions acceptance/topo_sd_reload/testdata/disp.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[dispatcher]
ID = "disp_1-ff00_0_110"
id = "disp_1-ff00_0_110"

[features]
AllowRunAsRoot = true
allow_run_as_root = true

[log.console]
level = "trace"
20 changes: 9 additions & 11 deletions acceptance/topo_sd_reload/testdata/sd.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
[general]
ReconnectToDispatcher = true
ConfigDir = "/"
ID = "sd1-ff00_0_110"
reconnect_to_dispatcher = true
config_dir = "/"
id = "sd1-ff00_0_110"

[trustDB]
Connection = "sd1-ff00_0_110.trust.db"
Backend = "sqlite"
[trust_db]
connection = "sd1-ff00_0_110.trust.db"

[log.console]
level = "trace"

[sd]
Public = "[242.254.100.2]:0"
address = "[242.254.100.2]:0"

[sd.pathDB]
Connection = "sd1-ff00_0_110.path.db"
Backend = "sqlite"
[path_db]
connection = "sd1-ff00_0_110.path.db"

[metrics]
Prometheus = "242.254.100.2:30455"
prometheus = "242.254.100.2:30455"
2 changes: 0 additions & 2 deletions docker/testimages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ container_image(
":sig_entrypoint",

],
stamp = True,
workdir = "/share",
entrypoint = ["./sig.sh"],
)
Expand Down Expand Up @@ -118,7 +117,6 @@ container_image(
":tester_integration_scripts",
":tester_binaries",
],
stamp = True,
workdir = "/share",
cmd = "tail -f /dev/null"
)
Expand Down
1 change: 0 additions & 1 deletion go/border/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ go_library(
"//go/lib/layers:go_default_library",
"//go/lib/log:go_default_library",
"//go/lib/overlay/conn:go_default_library",
"//go/lib/profile:go_default_library",
"//go/lib/prom:go_default_library",
"//go/lib/ringbuf:go_default_library",
"//go/lib/scmp:go_default_library",
Expand Down
21 changes: 10 additions & 11 deletions go/border/brconf/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package brconf

import (
"io"
"strings"

"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/config"
Expand All @@ -27,11 +28,11 @@ var _ config.Config = (*Config)(nil)

// Config is the border router configuration that is loaded from file.
type Config struct {
General env.General
Features env.Features
Logging log.Config `toml:"log,omitempty"`
Metrics env.Metrics
BR BR
General env.General `toml:"general,omitempty"`
Features env.Features `toml:"features,omitempty"`
Logging log.Config `toml:"log,omitempty"`
Metrics env.Metrics `toml:"metrics,omitempty"`
BR BR `toml:"br,omitempty"`
}

func (cfg *Config) InitDefaults() {
Expand Down Expand Up @@ -72,11 +73,9 @@ var _ config.Config = (*BR)(nil)

// BR contains the border router specific parts of the configuration.
type BR struct {
// Profile enables cpu and memory profiling.
Profile bool
// RollbackFailAction indicates the action that should be taken
// if the rollback fails.
RollbackFailAction FailAction
RollbackFailAction FailAction `toml:"rollback_fail_action,omitempty"`
}

func (cfg *BR) InitDefaults() {
Expand All @@ -101,9 +100,9 @@ type FailAction string

const (
// FailActionFatal indicates that the process exits on error.
FailActionFatal FailAction = "Fatal"
FailActionFatal FailAction = "fatal"
// FailActionContinue indicates that the process continues on error.
FailActionContinue FailAction = "Continue"
FailActionContinue FailAction = "continue"
)

func (f *FailAction) Validate() error {
Expand All @@ -116,7 +115,7 @@ func (f *FailAction) Validate() error {
}

func (f *FailAction) UnmarshalText(text []byte) error {
switch FailAction(text) {
switch FailAction(strings.ToLower(string(text))) {
case FailActionFatal:
*f = FailActionFatal
case FailActionContinue:
Expand Down
2 changes: 0 additions & 2 deletions go/border/brconf/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func InitTestConfig(cfg *Config) {
}

func InitTestBRConfig(cfg *BR) {
cfg.Profile = true
}

func CheckTestConfig(t *testing.T, cfg *Config, id string) {
Expand All @@ -54,6 +53,5 @@ func CheckTestConfig(t *testing.T, cfg *Config, id string) {
}

func CheckTestBRConfig(t *testing.T, cfg *BR) {
assert.False(t, cfg.Profile)
assert.Equal(t, FailActionFatal, cfg.RollbackFailAction)
}
Loading