config

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileName = ".pipeops.json"
	ConfigDirName  = ".pipeops"
)

Variables

View Source
var (
	// These can be set during build using -ldflags
	DefaultClientID = "pipeops_default_client" // Can be overridden at build time
	// DefaultAPIURL   = "https://api.pipeops.sh"                 // Can be overridden at build time
	DefaultAPIURL = "http://localhost:8002"  // Can be overridden at build time
	DefaultScopes = "user:read,project:read" // Can be overridden at build time
)

Build-time configuration variables (set during compilation)

Functions

func GetAPIURL added in v0.2.9

func GetAPIURL() string

GetAPIURL returns the API URL from environment or build-time default

func GetClientID added in v0.2.9

func GetClientID() string

GetClientID returns the OAuth client ID from environment or build-time default

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the configuration directory path

func GetDefaultScopes added in v0.2.9

func GetDefaultScopes() []string

GetDefaultScopes returns the default scopes

func Save

func Save(cfg *Config) error

Save writes configuration to disk with secure permissions

Types

type Config

type Config struct {
	OAuth    *OAuthConfig `json:"oauth,omitempty"`
	Settings *Settings    `json:"settings,omitempty"`
}

Config represents the CLI configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a new config with default values

func Load

func Load() (*Config, error)

Load reads configuration from disk

func (*Config) ClearAuth

func (c *Config) ClearAuth()

ClearAuth removes authentication information

func (*Config) IsAuthenticated

func (c *Config) IsAuthenticated() bool

IsAuthenticated checks if the user has valid authentication

func (*Config) IsAuthenticatedWithServer added in v0.2.9

func (c *Config) IsAuthenticatedWithServer() bool

IsAuthenticatedWithServer validates authentication with the server

type OAuthConfig

type OAuthConfig struct {
	ClientID     string    `json:"client_id"`
	ClientSecret string    `json:"client_secret"` // Not used with PKCE, kept for compatibility
	BaseURL      string    `json:"base_url"`
	AccessToken  string    `json:"access_token,omitempty"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	ExpiresAt    time.Time `json:"expires_at,omitempty"`
	Scopes       []string  `json:"scopes,omitempty"`
}

OAuthConfig holds OAuth-related configuration

type Settings

type Settings struct {
	DefaultRegion string `json:"default_region,omitempty"`
	OutputFormat  string `json:"output_format,omitempty"`
	Debug         bool   `json:"debug,omitempty"`
}

Settings holds general CLI settings

Jump to

Keyboard shortcuts

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