Skip to content

Conversation

jordan-rash
Copy link

I have found myself copy and pasting this function in a handful of projects, so I thought I would PR for consideration into orbit.

This will create you a nats.Conn based on the configuration you provide, which is really helpful when you want to support a handful of auth methods in a CLI or something.

The hierarchy is

1. NatsContext - If provided, uses NATS context configuration
2. NatsCredentialsFile - Uses a credentials file
3. NatsUserJWT + NatsUserSeed - JWT-based authentication
4. NatsUserNkey + NatsUserSeed - NKey-based authentication
5. NatsUser + NatsUserPassword - Basic username/password authentication

Signed-off-by: Jordan Rash <[email protected]>
Signed-off-by: Jordan Rash <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant