config

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 NormalizeAPIURL added in v0.20.1

func NormalizeAPIURL(s string) string

NormalizeAPIURL makes a full API URL from a deployment name, host or URL. The help names "us1" and plain hosts as deployments, but the HTTP client fails on a URL without a scheme. An empty value stays empty.

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), the config file, or the default 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"`
	Deployment        string `yaml:"deployment,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