warehouse/config/resource.go

40 lines
758 B
Go
Raw Normal View History

2024-11-13 21:16:22 +01:00
package config
type Environment string
const (
Dev Environment = "dev"
Staging = "staging"
Production = "prod"
)
// Config holds all configuration values
type Config struct {
ConfigPath string `toml:"-"`
SavePath string `toml:"savePath"`
BaseUrl string `toml:"base_url"`
Port int `toml:"port"`
}
// New returns a pointer to a default configuration with all empty values
func New() *Config {
return &Config{
ConfigPath: "",
Port: 0,
SavePath: "",
BaseUrl: "",
}
}
// Default returns a pointer to a default configuration
func Default() *Config {
return &Config{
ConfigPath: "./config.toml",
BaseUrl: "http://localhost:8080",
Port: 8080,
SavePath: "./storage",
}
}