Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Add config file loction to client info
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Jellick <[email protected]>
  • Loading branch information
cjellick committed Aug 12, 2023
1 parent b270f5a commit 8a974fc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/cli/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func TestInfo(t *testing.T) {

r, w, _ := os.Pipe()
os.Stdout = w
os.Setenv("ACORN_CONFIG_FILE", "/fake-file")

// Mock client factory just returns the gomock client.
cmd := NewInfo(CommandContext{
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/testdata/info/info_test-a.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
client:
cli:
acornConfig: /fake-file
acornServers:
- acorn.io
version:
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/testdata/info/info_test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
client:
cli:
acornConfig: /fake-file
acornServers:
- acorn.io
version:
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/testdata/info/info_test_empty.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
client:
cli:
acornConfig: /fake-file
acornServers:
- acorn.io
version:
Expand Down
3 changes: 2 additions & 1 deletion pkg/cli/testdata/info/info_test_json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"cli": {
"acornServers": [
"acorn.io"
]
],
"acornConfig": "/fake-file"
}
},
"projects": {
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/testdata/info/info_test_yaml.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
client:
cli:
acornConfig: /fake-file
acornServers:
- acorn.io
version:
Expand Down
4 changes: 3 additions & 1 deletion pkg/config/cliconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type CLIConfig struct {
ProjectAliases map[string]string `json:"projectAliases,omitempty"`
DefaultContext string `json:"defaultContext,omitempty"`
CurrentProject string `json:"currentProject,omitempty"`
AcornConfig string `json:"acornConfig,omitempty"`

// ProjectURLs is used for testing to return EndpointURLs for remote projects
ProjectURLs map[string]string `json:"projectURLs,omitempty"`
Expand Down Expand Up @@ -128,7 +129,8 @@ func ReadCLIConfig(kubeconfigOnly bool) (*CLIConfig, error) {
return nil, err
}
result := &CLIConfig{
authsLock: &sync.Mutex{},
authsLock: &sync.Mutex{},
AcornConfig: filename,
}
if err := yaml.Unmarshal(data, result); err != nil {
return nil, err
Expand Down

0 comments on commit 8a974fc

Please sign in to comment.