config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIDefaultURL    = "https://api.apono.io"
	AppDefaultURL    = "https://app.apono.io"
	PortalDefaultURL = "https://portal.apono.io"
)

Variables

View Source
var (
	ErrProfileNotExists  = errors.New("profile not exists")
	ErrNoProfiles        = errors.New("no profiles configured, run `apono login` to create a profile")
	ErrorNoActiveProfile = errors.New("no active profile configured, run `apono login` to create a profile")
)

Functions

func CreateProfileContext added in v1.1.1

func CreateProfileContext(ctx context.Context, profileName string) context.Context

func GetOAuthAuthURL

func GetOAuthAuthURL(appURL string) string

func GetOAuthTokenURL

func GetOAuthTokenURL(appURL string) string

func Save

func Save(cfg *Config) error

Types

type AuthConfig

type AuthConfig struct {
	ActiveProfile ProfileName                   `json:"active_profile"`
	Profiles      map[ProfileName]SessionConfig `json:"profiles"`
}

type Config

type Config struct {
	Auth AuthConfig `json:"auth"`
}

func Get

func Get() (*Config, error)

type ProfileName

type ProfileName string

type SessionConfig

type SessionConfig struct {
	ClientID  string       `json:"client_id"`
	ApiURL    string       `json:"api_url"`
	AppURL    string       `json:"app_url"`
	PortalURL string       `json:"portal_url"`
	AccountID string       `json:"account_id"`
	UserID    string       `json:"user_id"`
	Token     oauth2.Token `json:"token"`
	CreatedAt time.Time    `json:"created_at"`
}

func GetCurrentProfile added in v1.1.1

func GetCurrentProfile(ctx context.Context) (*SessionConfig, error)

func GetProfileByName added in v1.1.1

func GetProfileByName(profileName ProfileName) (*SessionConfig, error)

func (SessionConfig) GetOAuth2Config

func (c SessionConfig) GetOAuth2Config() oauth2.Config

Jump to

Keyboard shortcuts

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