config

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDefault

func CreateDefault() error

CreateDefault creates a default config file with cloud and localhost instances

func Exists

func Exists() bool

Exists checks if the config file exists at the default location

func Path

func Path() string

Path returns the default config file path Linux/macOS: ~/.config/coolify/config.json Windows: %APPDATA%\coolify\config.json (e.g., C:\Users\username\AppData\Roaming\coolify\config.json)

func SaveToFile

func SaveToFile(path string, cfg *Config) error

SaveToFile saves config to a specific file path

Types

type Config

type Config struct {
	Instances           []Instance `json:"instances"`
	LastUpdateCheckTime string     `json:"lastUpdateCheckTime"`
	// contains filtered or unexported fields
}

Config holds all CLI configuration

func Load

func Load() (*Config, error)

Load loads config from the default location

func LoadFromFile

func LoadFromFile(path string) (*Config, error)

LoadFromFile loads config from a specific file path

func New

func New() *Config

New creates a new config with default values

func (*Config) AddInstance

func (c *Config) AddInstance(instance Instance) error

AddInstance adds a new instance to the configuration

func (*Config) GetDefault

func (c *Config) GetDefault() (*Instance, error)

GetDefault returns the default instance

func (*Config) GetInstance

func (c *Config) GetInstance(name string) (*Instance, error)

GetInstance gets an instance by name

func (*Config) ListInstances

func (c *Config) ListInstances() []Instance

ListInstances returns all instances

func (*Config) RemoveInstance

func (c *Config) RemoveInstance(name string) error

RemoveInstance removes an instance by name

func (*Config) Save

func (c *Config) Save() error

Save saves config to the default location

func (*Config) SetDefault

func (c *Config) SetDefault(name string) error

SetDefault sets the default instance by name

func (*Config) UpdateInstanceToken

func (c *Config) UpdateInstanceToken(name, token string) error

UpdateInstanceToken updates the token for an instance

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the entire config

type Instance

type Instance struct {
	Name    string `json:"name"`
	FQDN    string `json:"fqdn"`
	Token   string `json:"token" sensitive:"true"`
	Default bool   `json:"default,omitempty"`
}

Instance represents a Coolify instance configuration

func (*Instance) Validate

func (i *Instance) Validate() error

Validate validates the instance configuration

Jump to

Keyboard shortcuts

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