You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
config.Base=a.askInput("Base URI", config.Base, true, "The entrypoint of the API, where Restish can look for an API description document and apply authentication.\nExample: https://api.example.com")
74
74
75
+
askLoadBaseAPI(a, config)
76
+
}
77
+
78
+
funcaskLoadBaseAPI(aasker, config*APIConfig) {
79
+
varauthAPIAuth
80
+
75
81
dummy:=&cobra.Command{}
76
82
ifapi, err:=Load(config.Base, dummy); err==nil {
77
83
// Found an API, auto-load settings.
78
-
iflen(api.Auth) >0 {
79
-
auth:=api.Auth[0]
80
84
81
-
ifconfig.Profiles==nil {
82
-
config.Profiles=map[string]*APIProfile{}
85
+
ifapi.AutoConfig.Auth.Name!="" {
86
+
// Found auto-configuration settings.
87
+
fmt.Println("Found API auto-configuration, setting up default profile...")
Copy file name to clipboardExpand all lines: docs/configuration.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -53,13 +53,15 @@ Should TTY autodetection for colored output cause any problems, you can manually
53
53
Adding or editing an API is possible via an interactive terminal UI:
54
54
55
55
```bash
56
-
$ restish api configure $NAME
56
+
$ restish api configure $NAME [$BASE_URI]
57
57
```
58
58
59
59
You should see something like the following, which enables you to create and edit profiles, headers, query params, and auth, eventually saving the data to `~/.restish/apis.json`:
If the API offers autoconfiguration data (e.g. through the [`x-cli-config` OpenAPI extension](/openapi.md#AutoConfiguration)) then you may be prompted for other values and some settings may already be configured for you.
64
+
63
65
Once an API is configured, you can start using it by using its short name. For example, given an API named `example`:
0 commit comments