Documentation
¶
Overview ¶
Package config provides centralized configuration management for the Nexlayer CLI.
Package config provides backward compatibility with the old configuration system. New code should use the pkg/core/config package directly.
Index ¶
- Constants
- func GetAPIURL() string
- func GetCacheDir() (string, error)
- func GetConfigDir() (string, error)
- func GetDefaultShell() string
- func GetLogLevel() string
- func GetProjectNamespace() string
- func GetRegistryConfig() (string, string, string)
- func GetToken() string
- func GetUserAgent() string
- func IsDebug() bool
- func IsDevelopment() bool
- func Save() error
- func ValidateConfig() error
- type Config
- type Manager
- func (m *Manager) GetAPIEndpoint(env string) string
- func (m *Manager) GetDefaultNamespace() string
- func (m *Manager) GetString(key string) string
- func (m *Manager) GetStringMap(key string) map[string]string
- func (m *Manager) Save() error
- func (m *Manager) Set(key string, value interface{})
- func (m *Manager) SetDefaultNamespace(namespace string) error
Constants ¶
const ( // DefaultAPIURL is the default Nexlayer API endpoint DefaultAPIURL = "https://api.nexlayer.dev" // ConfigFileName is the name of the configuration file ConfigFileName = "config.yaml" // CacheDir is the directory for caching CLI data CacheDir = ".nexlayer" // DefaultPort is the default port for local development DefaultPort = 3000 )
Configuration constants
Variables ¶
This section is empty.
Functions ¶
func GetCacheDir ¶
GetCacheDir returns the platform-specific cache directory
func GetConfigDir ¶
GetConfigDir returns the platform-specific configuration directory
func GetDefaultShell ¶
func GetDefaultShell() string
GetDefaultShell returns the default shell for the current platform
func GetProjectNamespace ¶
func GetProjectNamespace() string
GetProjectNamespace returns the current project namespace
func GetRegistryConfig ¶
GetRegistryConfig returns the container registry configuration
func GetToken ¶
func GetToken() string
GetToken returns the authentication token from environment or config
func IsDevelopment ¶
func IsDevelopment() bool
IsDevelopment returns true if running in development mode
func ValidateConfig ¶
func ValidateConfig() error
ValidateConfig checks if all required configuration is present
Types ¶
type Config ¶
type Config struct {
Env map[string]string `yaml:"env"`
Registry struct {
Type string `yaml:"type"`
URL string `yaml:"url"`
Username string `yaml:"username"`
Region string `yaml:"region"`
Project string `yaml:"project"`
} `yaml:"registry"`
Project struct {
Name string `yaml:"name"`
Namespace string `yaml:"namespace"`
Domain string `yaml:"domain"`
} `yaml:"project"`
API struct {
URL string `yaml:"url"`
Token string `yaml:"token"`
} `yaml:"api"`
Build struct {
Context string `yaml:"context"`
Tag string `yaml:"tag"`
} `yaml:"build"` // Container registry type (ghcr, dockerhub, gcr, ecr, artifactory, gitlab)
}
Config holds the CLI configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles configuration management
func (*Manager) GetAPIEndpoint ¶
GetAPIEndpoint returns the API endpoint for the given environment
func (*Manager) GetDefaultNamespace ¶
GetDefaultNamespace returns the default namespace
func (*Manager) GetStringMap ¶
GetStringMap gets a string map from configuration
func (*Manager) SetDefaultNamespace ¶
SetDefaultNamespace sets the default namespace