can pull states from email and fill config file
This commit is contained in:
@@ -13,6 +13,7 @@ type Config struct {
|
||||
Interval Duration
|
||||
States []State
|
||||
Storage []string
|
||||
Client string
|
||||
Once bool
|
||||
Brokers struct {
|
||||
NTG struct {
|
||||
@@ -57,7 +58,7 @@ func Get() *Config {
|
||||
}
|
||||
|
||||
func Set(other Config) {
|
||||
b, err := json.Marshal(other)
|
||||
b, err := json.MarshalIndent(other, "", " ")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ func (d Duration) Get() time.Duration {
|
||||
return time.Duration(d)
|
||||
}
|
||||
|
||||
func (d *Duration) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(d.Get().String())
|
||||
}
|
||||
|
||||
func (d *Duration) UnmarshalJSON(b []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user