mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-24 05:42:40 +08:00

* h1_title config * introduce h1_title in config * add h1_drop config setting * allsow allow h1_drop in config
30 lines
571 B
Go
30 lines
571 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/kovetskiy/ko"
|
|
)
|
|
|
|
type Config struct {
|
|
Username string `env:"MARK_USERNAME" toml:"username"`
|
|
Password string `env:"MARK_PASSWORD" toml:"password"`
|
|
BaseURL string `env:"MARK_BASE_URL" toml:"base_url"`
|
|
H1Title bool `env:"MARK_H1_TITLE" toml:"h1_title"`
|
|
H1Drop bool `env:"MARK_H1_DROP" toml:"h1_drop"`
|
|
}
|
|
|
|
func LoadConfig(path string) (*Config, error) {
|
|
config := &Config{}
|
|
err := ko.Load(path, config)
|
|
if err != nil {
|
|
if os.IsNotExist(err) {
|
|
return config, nil
|
|
}
|
|
|
|
return nil, err
|
|
}
|
|
|
|
return config, nil
|
|
}
|