credentials

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 3 Imported by: 1

README

Credentials

Helper module for parsing UpCloud credentials from tool specific configuration, environment variables, or the system keyring. The goal of the module is to synchronize credentials parsing across different Golang based UpCloud developer tools.

Documentation

Index

Constants

View Source
const KeyringServiceName string = "UpCloud"

KeyringServiceName is the name of the service to use when using the system keyring

View Source
const KeyringTokenUser string = ""

KeyringTokenUser is the username to use for the token in the system keyring

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Username string
	Password string
	Token    string
	// contains filtered or unexported fields
}

func Parse

func Parse(config Credentials) (Credentials, error)

Parse reads credentials from environment variables or the system keyring and allows overriding these with parameters. If both basic auth and token are provided, basic auth credentials will be omitted from the return value. Any credentials defined in the parameters will take precedence over those read from the environment and any credentials defined in the environment will take precedence over those read from the keyring.

func (Credentials) IsDefined

func (c Credentials) IsDefined() bool

func (Credentials) Source

func (c Credentials) Source() CredentialsSource

func (Credentials) Type

func (c Credentials) Type() CredentialsType

type CredentialsSource

type CredentialsSource string
const (
	CredentialsSourceConfiguration CredentialsSource = "configuration"
	CredentialsSourceEnvironment   CredentialsSource = "environment"
	CredentialsSourceKeyring       CredentialsSource = "keyring"
)

type CredentialsType

type CredentialsType string
const (
	CredentialsTypeBasic CredentialsType = "basic"
	CredentialsTypeToken CredentialsType = "token"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL