Skip to content

Commit

Permalink
reduce size of configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian authored and yndu13 committed Aug 14, 2024
1 parent 134baa2 commit 4002e73
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion config/configure_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestDoConfigureGet(t *testing.T) {
ctx.Flags().Get("profile").SetAssigned(true)
ctx.Flags().Get("profile").SetValue("default")
doConfigureGet(ctx, []string{})
assert.Equal(t, "{\n\t\"name\": \"default\",\n\t\"mode\": \"AK\",\n\t\"access_key_id\": \"default_aliyun_access_key_id\",\n\t\"access_key_secret\": \"default_aliyun_access_key_secret\",\n\t\"sts_token\": \"\",\n\t\"sts_region\": \"\",\n\t\"ram_role_name\": \"\",\n\t\"ram_role_arn\": \"\",\n\t\"ram_session_name\": \"\",\n\t\"source_profile\": \"\",\n\t\"private_key\": \"\",\n\t\"key_pair_name\": \"\",\n\t\"expired_seconds\": 0,\n\t\"verified\": \"\",\n\t\"region_id\": \"\",\n\t\"output_format\": \"json\",\n\t\"language\": \"\",\n\t\"site\": \"\",\n\t\"retry_timeout\": 0,\n\t\"connect_timeout\": 0,\n\t\"retry_count\": 0,\n\t\"process_command\": \"\",\n\t\"credentials_uri\": \"\",\n\t\"oidc_provider_arn\": \"\",\n\t\"oidc_token_file\": \"\"\n}\n\n", w.String())
assert.Equal(t, "{\n\t\"name\": \"default\",\n\t\"mode\": \"AK\",\n\t\"access_key_id\": \"default_aliyun_access_key_id\",\n\t\"access_key_secret\": \"default_aliyun_access_key_secret\",\n\t\"output_format\": \"json\"\n}\n\n", w.String())

//testcase 5
hookLoadConfiguration = func(fn func(path string) (*Configuration, error)) func(path string) (*Configuration, error) {
Expand Down
46 changes: 23 additions & 23 deletions config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,29 @@ const (
type Profile struct {
Name string `json:"name"`
Mode AuthenticateMode `json:"mode"`
AccessKeyId string `json:"access_key_id"`
AccessKeySecret string `json:"access_key_secret"`
StsToken string `json:"sts_token"`
StsRegion string `json:"sts_region"`
RamRoleName string `json:"ram_role_name"`
RamRoleArn string `json:"ram_role_arn"`
RoleSessionName string `json:"ram_session_name"`
SourceProfile string `json:"source_profile"`
PrivateKey string `json:"private_key"`
KeyPairName string `json:"key_pair_name"`
ExpiredSeconds int `json:"expired_seconds"`
Verified string `json:"verified"`
RegionId string `json:"region_id"`
OutputFormat string `json:"output_format"`
Language string `json:"language"`
Site string `json:"site"`
ReadTimeout int `json:"retry_timeout"`
ConnectTimeout int `json:"connect_timeout"`
RetryCount int `json:"retry_count"`
ProcessCommand string `json:"process_command"`
CredentialsURI string `json:"credentials_uri"`
OIDCProviderARN string `json:"oidc_provider_arn"`
OIDCTokenFile string `json:"oidc_token_file"`
AccessKeyId string `json:"access_key_id,omitempty"`
AccessKeySecret string `json:"access_key_secret,omitempty"`
StsToken string `json:"sts_token,omitempty"`
StsRegion string `json:"sts_region,omitempty"`
RamRoleName string `json:"ram_role_name,omitempty"`
RamRoleArn string `json:"ram_role_arn,omitempty"`
RoleSessionName string `json:"ram_session_name,omitempty"`
SourceProfile string `json:"source_profile,omitempty"`
PrivateKey string `json:"private_key,omitempty"`
KeyPairName string `json:"key_pair_name,omitempty"`
ExpiredSeconds int `json:"expired_seconds,omitempty"`
Verified string `json:"verified,omitempty"`
RegionId string `json:"region_id,omitempty"`
OutputFormat string `json:"output_format,omitempty"`
Language string `json:"language,omitempty"`
Site string `json:"site,omitempty"`
ReadTimeout int `json:"retry_timeout,omitempty"`
ConnectTimeout int `json:"connect_timeout,omitempty"`
RetryCount int `json:"retry_count,omitempty"`
ProcessCommand string `json:"process_command,omitempty"`
CredentialsURI string `json:"credentials_uri,omitempty"`
OIDCProviderARN string `json:"oidc_provider_arn,omitempty"`
OIDCTokenFile string `json:"oidc_token_file,omitempty"`
parent *Configuration //`json:"-"`
}

Expand Down

0 comments on commit 4002e73

Please sign in to comment.