Skip to content

feat(config): move telemetry config in profile #427

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

Merged
merged 3 commits into from
Jun 1, 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
1 change: 1 addition & 0 deletions scw/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func TestNewClientWithOptions(t *testing.T) {
s(testDefaultOrganizationID),
s(string(testDefaultRegion)),
s(string(testDefaultZone)),
b(true),
}

client, err := NewClient(WithProfile(profile))
Expand Down
2 changes: 1 addition & 1 deletion scw/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ profiles:
type Config struct {
Profile `yaml:",inline"`
ActiveProfile *string `yaml:"active_profile,omitempty"`
SendTelemetry *bool `yaml:"send_telemetry,omitempty"`
Profiles map[string]*Profile `yaml:"profiles,omitempty"`
}

Expand All @@ -114,6 +113,7 @@ type Profile struct {
DefaultOrganizationID *string `yaml:"default_organization_id,omitempty"`
DefaultRegion *string `yaml:"default_region,omitempty"`
DefaultZone *string `yaml:"default_zone,omitempty"`
SendTelemetry *bool `yaml:"send_telemetry,omitempty"`
}

func (p *Profile) String() string {
Expand Down
14 changes: 7 additions & 7 deletions scw/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,11 @@ func TestLoadProfileAndActiveProfile(t *testing.T) {
func TestConfigString(t *testing.T) {
var c = &Config{
Profile: Profile{
AccessKey: s(v2ValidAccessKey),
SecretKey: s(v2ValidSecretKey),
AccessKey: s(v2ValidAccessKey),
SecretKey: s(v2ValidSecretKey),
SendTelemetry: b(true),
},
ActiveProfile: s(v2ValidProfile),
SendTelemetry: b(true),
Profiles: map[string]*Profile{
v2ValidProfile: {
AccessKey: s(v2ValidAccessKey2),
Expand All @@ -491,8 +491,8 @@ func TestConfigString(t *testing.T) {

testhelpers.Equals(t, `access_key: SCW1234567890ABCDEFG
secret_key: 7363616c-xxxx-xxxx-xxxx-xxxxxxxxxxxx
active_profile: flantier
send_telemetry: true
active_profile: flantier
profiles:
flantier:
access_key: SCW234567890ABCDEFGH
Expand Down Expand Up @@ -756,11 +756,11 @@ access_key: SCW1234567890ABCDEFG
t.Run("full", run(&testCase{
config: &Config{
Profile: Profile{
AccessKey: s(v2ValidAccessKey),
SecretKey: s(v2ValidSecretKey),
AccessKey: s(v2ValidAccessKey),
SecretKey: s(v2ValidSecretKey),
SendTelemetry: b(true),
},
ActiveProfile: s(v2ValidProfile),
SendTelemetry: b(true),
Profiles: map[string]*Profile{
"profile1": {
AccessKey: s(v2ValidAccessKey2),
Expand Down