config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAPIURL = "https://us1.oodle.ai"

DefaultAPIURL is the default Oodle API URL.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the path to the configuration file. The path can be overridden by the OODLE_CONFIG environment variable.

func ResolveAPIURL added in v0.6.0

func ResolveAPIURL() string

ResolveAPIURL returns the Oodle API URL from environment variables (OODLE_DEPLOYMENT > OODLE_API_URL > OODLE_URL) or the default URL. The precedence matches LoadConfig: OODLE_DEPLOYMENT wins over OODLE_API_URL, which wins over OODLE_URL. This is useful for commands that need an API URL without full config resolution (e.g. unauthenticated endpoints).

Types

type Config

type Config struct {
	APIKey            string `yaml:"api_key,omitempty"`
	OAuthAccessToken  string `yaml:"oauth_access_token,omitempty"`
	OAuthRefreshToken string `yaml:"oauth_refresh_token,omitempty"`
	OAuthTokenExpiry  string `yaml:"oauth_token_expiry,omitempty"`
	OAuthClientID     string `yaml:"oauth_client_id,omitempty"`
	OAuthAuthServer   string `yaml:"oauth_auth_server,omitempty"`
	Instance          string `yaml:"instance"`
	APIURL            string `yaml:"api_url"`
}

Config holds the resolved Oodle CLI configuration.

func LoadConfig

func LoadConfig(flagAPIKey, flagInstance, flagAPIURL string) (*Config, error)

LoadConfig resolves configuration with the precedence:

CLI flags > env vars > config file > defaults.

Empty strings in flag arguments are treated as "not set".

func (*Config) OAuthExpiryTime added in v0.5.0

func (c *Config) OAuthExpiryTime() (time.Time, bool)

OAuthExpiryTime parses OAuthTokenExpiry when set.

func (*Config) Save

func (c *Config) Save() error

Save writes the config to the config file path, creating parent directories (mode 0700) and writing the file with mode 0600.

Jump to

Keyboard shortcuts

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