danielgtaylor / danielgtaylor/openapi-cli-generator

How to setup the credentials file?

Open
#38 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
218
Forks
54
PR merge metrics
No merged PRs in 30d

Description

Hello,
I can't figure out how to setup a credentials file. I'm a complete go newbie. This is my `main.go`:
```go
package main

import (
"github.com/danielgtaylor/openapi-cli-generator/cli"
"github.com/danielgtaylor/openapi-cli-generator/apikey"
)

func main() {
cli.Init(&cli.Config{
AppName: "example",
EnvPrefix: "EXAMPLE",
Version: "1.0.0",
})

exampleRegister(false)
apikey.Init("Authorization", apikey.LocationHeader)

cli.Creds.Set("profiles.default.api_key", "mykey")

cli.Root.Execute()
}

```

This works, but the api key is hardcorded. Where and how should I define the key in the credentials file? I've tried:

`./.example/config.json`:

```json
{ "example":
{ "profiles":
{ "default":
{ "api_key": "mykey"
}
}
}
}
```

Any help is appreciated!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.