config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfigPath  = filepath.Join(home, ".syftbox", "config.json")
	DefaultDataDir     = filepath.Join(home, "SyftBox")
	DefaultServerURL   = "https://syftbox.net"
	DefaultClientURL   = "http://localhost:7938"
	DefaultLogFilePath = filepath.Join(home, ".syftbox", "logs", "syftbox.log")
	DefaultAppsEnabled = true
)
View Source
var (
	ErrInvalidURL   = errors.New("invalid url")
	ErrInvalidEmail = utils.ErrInvalidEmail
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDir      string `json:"data_dir" mapstructure:"data_dir"`
	Email        string `json:"email" mapstructure:"email"`
	ServerURL    string `json:"server_url" mapstructure:"server_url"`
	ClientURL    string `json:"client_url,omitempty" mapstructure:"client_url,omitempty"`
	ClientToken  string `json:"client_token,omitempty" mapstructure:"client_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty" mapstructure:"refresh_token,omitempty"`

	// do not persist, keep in memory
	AppsEnabled bool   `json:"-" mapstructure:"apps_enabled"`
	AccessToken string `json:"-" mapstructure:"access_token"`
	Path        string `json:"-" mapstructure:"config_path"`
}

func LoadFromFile

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

func LoadFromReader

func LoadFromReader(path string, reader io.ReadCloser) (*Config, error)

func (Config) LogValue

func (c Config) LogValue() slog.Value

func (*Config) Save

func (c *Config) Save() error

func (*Config) Validate

func (c *Config) Validate() error

Jump to

Keyboard shortcuts

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