mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-16 21:37:29 -06:00
*fiddles*
This commit is contained in:
parent
11b18f986c
commit
48ab34f71a
12 changed files with 221 additions and 74 deletions
|
|
@ -40,22 +40,14 @@ type Config struct {
|
|||
|
||||
// FromFile returns a new config from a file, or an error if something goes amiss.
|
||||
func FromFile(path string) (*Config, error) {
|
||||
c, err := loadFromFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating config: %s", err)
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Default returns a new config with default values.
|
||||
// Not yet implemented.
|
||||
func Default() *Config {
|
||||
// TODO: find a way of doing this without code repetition, because having to
|
||||
// repeat all values here and elsewhere is annoying and gonna be prone to mistakes.
|
||||
return &Config{
|
||||
DBConfig: &DBConfig{},
|
||||
TemplateConfig: &TemplateConfig{},
|
||||
if path != "" {
|
||||
c, err := loadFromFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating config: %s", err)
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
return Empty(), nil
|
||||
}
|
||||
|
||||
// Empty just returns an empty config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue