mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-26 13:48:34 +00:00
feat: set version flag (#632)
This commit is contained in:
parent
8cc0f30291
commit
9edbda3daa
2 changed files with 17 additions and 2 deletions
|
@ -15,6 +15,7 @@ const (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
conf.Version
|
||||
Mode string `yaml:"mode" conf:"default:development"` // development or production
|
||||
Web WebConfig `yaml:"web"`
|
||||
Storage Storage `yaml:"storage"`
|
||||
|
@ -46,10 +47,15 @@ type WebConfig struct {
|
|||
|
||||
// New parses the CLI/Config file and returns a Config struct. If the file argument is an empty string, the
|
||||
// file is not read. If the file is not empty, the file is read and the Config struct is returned.
|
||||
func New() (*Config, error) {
|
||||
func New(buildstr string, description string) (*Config, error) {
|
||||
var cfg Config
|
||||
const prefix = "HBOX"
|
||||
|
||||
cfg.Version = conf.Version{
|
||||
Build: buildstr,
|
||||
Desc: description,
|
||||
}
|
||||
|
||||
help, err := conf.Parse(prefix, &cfg)
|
||||
if err != nil {
|
||||
if errors.Is(err, conf.ErrHelpWanted) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue