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

Integrating SSH Portal config #81

Closed
wants to merge 12 commits into from
Closed
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
11 changes: 8 additions & 3 deletions .lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ docker-compose-yaml: docker-compose.yml

project: "lagoon-sync"

# These ssh and api settings can be added to configure Lagoon outside of amazeeio.cloud infrastructure
# api: https://api.main.lagoon-core.cluster1.company.io/graphql
api: https://api.main.lagoon-core.test6.amazee.io/graphql
ssh: ssh.main.lagoon-core.test6.amazee.io:22

lagoon-sync:
ssh:
host: "example.ssh.lagoon.amazeeio.cloud"
host: "ssh.main.lagoon-core.test6.amazee.io"
port: "22"
privateKey: "~/.ssh/example_id_rsa"
privateKey: "~/.ssh/id_rsa"
verbose: true
mariadb:
config:
Expand Down Expand Up @@ -58,4 +63,4 @@ lagoon-sync:
local:
overrides:
config:
syncpath: "./config/sync"
syncpath: "./config/sync"
3 changes: 3 additions & 0 deletions assets/lagoon.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
api: https://api.lagoon.amazeeio.cloud/graphql
ssh: ssh.lagoon.amazeeio.cloud:32222

lagoon-sync:
ssh:
host: "ssh.lagoon.amazeeio.cloud"
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func processConfig(cfgFile string) error {
if !utils.FileExists(".lagoon-sync.yml") && !noCliInteraction {
var response string
// Ask user to safe-write config to '.lagoon-sync.yml'
fmt.Print("No configuration file found, do you want to add the file '.lagoon-sync.yml'? (y/n): ")
fmt.Print("No configuration file found, do you want to add the default config file '.lagoon-sync.yml'? (y/n): ")
_, err = fmt.Scanln(&response)
if err != nil {
return fmt.Errorf("failed to read user input: %v", err)
Expand Down
28 changes: 3 additions & 25 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,19 @@ func Test_processConfigEnv(t *testing.T) {
{
name: "Initial test",
args: args{
paths: []string{"../test-resources/config-tests/initial-test"},
DefaultConfigFileName: "intial-test-lagoon.yml",
},
want: "intial-test-lagoon.yml",
wantErr: false,
},
{
name: "Initial test - Empty path",
args: args{
paths: []string{},
DefaultConfigFileName: "../test-resources/config-tests/initial-test/intial-test-lagoon.yml",
},
want: "../test-resources/config-tests/initial-test/intial-test-lagoon.yml",
wantErr: false,
},
{
name: "Initial test - Multiple paths",
args: args{
paths: []string{"../test-resources/sync-test/tests-defaults", "../test-resources/sync-test/tests-lagoon-yml", "../test-resources/config-tests/initial-test"},
DefaultConfigFileName: ".lagoon.yml",
},
want: ".lagoon.yml",
want: "intial-test-lagoon.yml",
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := processConfigEnv(tt.args.paths, tt.args.DefaultConfigFileName)
err := processConfig(tt.args.DefaultConfigFileName)
if (err != nil) != tt.wantErr {
t.Errorf("processConfigEnv() error = %v, wantErr %v", err, tt.wantErr)
t.Errorf("processConfig() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("processConfigEnv() = %v, want %v", got, tt.want)
}
})
}
}
Loading