Skip to content

Commit

Permalink
docs: update configuration docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Dec 6, 2024
1 parent cfc7422 commit 8a05bde
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 67 deletions.
6 changes: 3 additions & 3 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ func readLagoonConfig(lc *lagoon.Config, file string) error {
// configuration to point to the amazeeio lagoon instance
if yesNo(fmt.Sprintf("Config file '%s' does not exist, do you want to create it with defaults?", file)) {
l := lagoon.Context{
GraphQL: "https://api.lagoon.amazeeio.cloud/graphql",
HostName: "ssh.lagoon.amazeeio.cloud",
GraphQL: "https://api.amazeeio.cloud/graphql",
HostName: "token.amazeeio.cloud",
Token: "",
Port: "32222",
Port: "22",
UI: "https://dashboard.amazeeio.cloud",
Kibana: "https://logs.amazeeio.cloud/",
}
Expand Down
16 changes: 9 additions & 7 deletions cmd/config_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"reflect"
"testing"

Expand All @@ -23,11 +24,11 @@ func TestConfigRead(t *testing.T) {
Default: "amazeeio",
Lagoons: map[string]lagoon.Context{
"amazeeio": {
GraphQL: "https://api.lagoon.amazeeio.cloud/graphql",
HostName: "ssh.lagoon.amazeeio.cloud",
Kibana: "https://logs-db-ui-lagoon-master.ch.amazee.io/",
UI: "https://ui-lagoon-master.ch.amazee.io",
Port: "32222",
GraphQL: "https://api.amazeeio.cloud/graphql",
HostName: "token.amazeeio.cloud",
Kibana: "https://logs.amazeeio.cloud/",
UI: "https://dashboard.amazeeio.cloud",
Port: "22",
},
},
UpdateCheckDisable: false,
Expand All @@ -49,8 +50,8 @@ func TestConfigRead(t *testing.T) {
Default: "amazeeio",
Lagoons: map[string]lagoon.Context{
"amazeeio": {
Kibana: "https://logs-db-ui-lagoon-master.ch.amazee.io/",
UI: "https://ui-lagoon-master.ch.amazee.io",
Kibana: "https://logs.amazeeio.cloud/",
UI: "https://dashboard.amazeeio.cloud",
},
},
UpdateCheckDisable: false,
Expand All @@ -66,6 +67,7 @@ func TestConfigRead(t *testing.T) {
tt.Fatal(err)
}
}
fmt.Println(lc, tc.expect)
if !reflect.DeepEqual(lc, tc.expect) {
tt.Fatalf("Read config does not match expected config")
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/testdata/lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ current: amazeeio
default: amazeeio
lagoons:
amazeeio:
graphql: https://api.lagoon.amazeeio.cloud/graphql
hostname: ssh.lagoon.amazeeio.cloud
kibana: https://logs-db-ui-lagoon-master.ch.amazee.io/
port: 32222
ui: https://ui-lagoon-master.ch.amazee.io
graphql: https://api.amazeeio.cloud/graphql
hostname: token.amazeeio.cloud
kibana: https://logs.amazeeio.cloud/
port: 22
ui: https://dashboard.amazeeio.cloud
updatecheckdisable: false
environmentfromdirectory: false
10 changes: 5 additions & 5 deletions cmd/testdata/lagoon.yml.invalid
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ current: amazeeio
default: amazeeio
lagoons:
amazeeio:
graphql: https://api.lagoon.amazeeio.cloud/graphql
hostname: ssh.lagoon.amazeeio.cloud
kibana: https://logs-db-ui-lagoon-master.ch.amazee.io/
port: 32222
ui: https://ui-lagoon-master.ch.amazee.io
graphql: https://api.amazeeio.cloud/graphql
hostname: token.amazeeio.cloud
kibana: https://logs.amazeeio.cloud/
port: 22
ui: https://dashboard.amazeeio.cloud
4 changes: 2 additions & 2 deletions cmd/testdata/lagoon.yml.missing
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ current: amazeeio
default: amazeeio
lagoons:
amazeeio:
kibana: https://logs-db-ui-lagoon-master.ch.amazee.io/
ui: https://ui-lagoon-master.ch.amazee.io
kibana: https://logs.amazeeio.cloud/
ui: https://dashboard.amazeeio.cloud
74 changes: 29 additions & 45 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Introduction

By default the CLI is configured to use the `amazeeio` Lagoon. But you can also define additional Lagoons if you need to.
By default the CLI is configured to use the `amazeeio` Lagoon. But you can also define additional Lagoon contexts if you need to.

The `.lagoon.yml` file will be installed in your home directory by default

Expand All @@ -11,85 +11,69 @@ current: amazeeio
default: amazeeio
lagoons:
amazeeio:
graphql: https://api.lagoon.amazeeio.cloud/graphql
hostname: ssh.lagoon.amazeeio.cloud
port: 32222
graphql: https://api.amazeeio.cloud/graphql
hostname: token.amazeeio.cloud
port: 22
token: ey.....xA
```
There are a few sections to cover off
* `current` is the current Lagoon that you will be using, if you only have the one, it will be `amazeeio`
* `default` is the default Lagoon to use, if you always use a particular Lagoon then you can set your preference as your default
* `lagoons` is where the actual connection parameters are stored for each Lagoon, they all follow the same template.
* `current` is the current Lagoon context that you will be using, if you only have the one, it will be `amazeeio`
* `default` is the default Lagoon context to use, if you always use a particular context then you can set your preference as your default
* `lagoons` is where the actual connection parameters are stored for each Lagoon context, they all follow the same template.
* `graphql` is the graphql endpoint
* `hostname` is the ssh hostname
* `port` is the ssh port
* `hostname` is the ssh token hostname
* `port` is the ssh token port
* `token` is the graphql token, this is automatically generate the first time you `lagoon login` and will automatically refresh if it expires via ssh.

# Add a Lagoon
If you want to add a different Lagoon to use, then you can use the CLI command to view the flags available
# Add a Lagoon context
If you want to add a different Lagoon context to use, then you can use the CLI command to view the flags available
```bash
lagoon config add --lagoon LagoonName
lagoon config add --lagoon example
```
## Example
```bash
lagoon config add --lagoon amazeeio \
--graphql https://api.lagoon.amazeeio.cloud/graphql \
--hostname ssh.lagoon.amazeeio.cloud \
--port 32222
--graphql https://api.amazeeio.cloud/graphql \
--hostname token.amazeeio.cloud \
--port 22
```

# Delete a Lagoon
If you want to remove a Lagoon, you can use
# Delete a Lagoon context
If you want to remove a Lagoon context, you can use
```bash
lagoon config delete --lagoon LagoonName
lagoon config delete --lagoon example
```
## Example
```bash
lagoon config delete --lagoon amazeeio
```

# Change default Lagoon
If you add additional Lagoons, you can select which one is the default you want to use by running
# Change default Lagoon context
If you add additional Lagoon contexts, you can select which one is the default you want to use by running
```bash
lagoon config default --lagoon LagoonName
lagoon config default --lagoon example
```
## Example
```bash
lagoon config default --lagoon amazeeio
```

# Use a different Lagoon
If you want to temporarily use a different Lagoon, when you run any commands you can specify the flag `--lagoon` or `-l` and then the name of the Lagoon
# Use a different Lagoon context
If you want to temporarily use a different Lagoon context, when you run any commands you can specify the flag `--lagoon` or `-l` and then the name of the context
## Example
```bash
lagoon --lagoon mylagoon list projects
lagoon --lagoon example list projects
```

# View Lagoons
You can view all the Lagoons you have configured by running
# View Lagoon contexts
You can view all the Lagoon contexts you have configured by running
```bash
lagoon config list
```
Output
```yaml
You have the following lagoons configured:
Name: amazeeio
- Hostname: ssh.lagoon.amazeeio.cloud
- GraphQL: https://api.lagoon.amazeeio.cloud/graphql
- Port: 32222
Name: mylagoon
- Hostname: ssh.mylagoon.example
- GraphQL: https://api.mylagoon.example/graphql
- Port: 32000
Name: local
- Hostname: localhost
- GraphQL: http://localhost:3000/graphql
- Port: 2020
Your default lagoon is:
Name: local
Your current lagoon is:
Name: local
NAME VERSION GRAPHQL SSH-HOSTNAME SSH-PORT SSH-KEY
amazeeio(default)(current) v2.22.0 https://api.amazeeio.cloud/graphql token.amazeeio.cloud 22 -
example v2.22.0 https://api.example.com/graphql token.example.com 22 -
```

0 comments on commit 8a05bde

Please sign in to comment.