config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL   = "https://api.runware.ai/v1"
	DefaultModel     = "runware:100@1"
	DefaultWidth     = 1024
	DefaultHeight    = 1024
	DefaultSteps     = 28
	DefaultCFGScale  = 3.5
	DefaultScheduler = "euler"
	DefaultOutputDir = "./outputs"
	DefaultOutputFmt = "png"
	DefaultFormat    = "table"
	DefaultEnv       = "production"
	DefaultMode      = "public"
)

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the config directory path.

func ConfigPath

func ConfigPath() string

ConfigPath returns the full path to the config file.

func DeletePreset

func DeletePreset(name string) error

DeletePreset removes a named preset.

func EnsureConfigDir

func EnsureConfigDir() error

EnsureConfigDir creates the config directory if it doesn't exist.

func GetAPIKey

func GetAPIKey() string

GetAPIKey returns the API key for the current environment.

func GetBaseURL

func GetBaseURL() string

GetBaseURL returns the API base URL.

func GetEnvironment

func GetEnvironment() string

GetEnvironment returns the current environment.

func GetMode

func GetMode() string

GetMode returns the current mode (internal/public).

func Init

func Init() error

Init sets up Viper to read from ~/.runware/config.yaml and sets defaults.

func IsInternal

func IsInternal() bool

IsInternal returns true if running in internal mode.

func ListPresets

func ListPresets() []string

ListPresets returns all preset names.

func MaskKey

func MaskKey(key string) string

MaskKey masks an API key for display, showing first 4 and last 4 characters.

func RemoveAPIKey

func RemoveAPIKey(env string) error

RemoveAPIKey removes the API key for the given environment.

func Save

func Save(cfg *Config) error

Save writes the config to disk and reloads Viper so subsequent Get() calls reflect the change.

func SavePreset

func SavePreset(name string, preset Preset) error

SavePreset saves a named preset.

func SetAPIKey

func SetAPIKey(env, key string) error

SetAPIKey saves an API key for the given environment.

func SetEnvironment

func SetEnvironment(env string) error

SetEnvironment saves the current environment.

Types

type Config

type Config struct {
	Environment string            `mapstructure:"environment" yaml:"environment"`
	APIKey      string            `mapstructure:"api_key" yaml:"api_key,omitempty"`
	StagingKey  string            `mapstructure:"staging_api_key" yaml:"staging_api_key,omitempty"`
	Mode        string            `mapstructure:"mode" yaml:"mode"`
	Defaults    Defaults          `mapstructure:"defaults" yaml:"defaults"`
	Presets     map[string]Preset `mapstructure:"presets" yaml:"presets,omitempty"`
}

Config is the full configuration structure.

func Get

func Get() *Config

Get returns the current merged config.

type Defaults

type Defaults struct {
	Model        string  `mapstructure:"model" yaml:"model"`
	Width        int     `mapstructure:"width" yaml:"width"`
	Height       int     `mapstructure:"height" yaml:"height"`
	Steps        int     `mapstructure:"steps" yaml:"steps"`
	CFGScale     float64 `mapstructure:"cfg_scale" yaml:"cfg_scale"`
	Scheduler    string  `mapstructure:"scheduler" yaml:"scheduler"`
	OutputDir    string  `mapstructure:"output_dir" yaml:"output_dir"`
	OutputFormat string  `mapstructure:"output_format" yaml:"output_format"`
	Format       string  `mapstructure:"format" yaml:"format"`
}

Defaults holds default values for inference commands.

type Preset

type Preset struct {
	Model     string  `yaml:"model,omitempty"`
	Width     int     `yaml:"width,omitempty"`
	Height    int     `yaml:"height,omitempty"`
	Steps     int     `yaml:"steps,omitempty"`
	CFGScale  float64 `yaml:"cfg_scale,omitempty"`
	Scheduler string  `yaml:"scheduler,omitempty"`
}

Preset is a named set of inference parameters.

func GetPreset

func GetPreset(name string) *Preset

GetPreset returns a named preset, or nil if not found.

Jump to

Keyboard shortcuts

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