ip-ddns/config/directadmin.go

28 lines
624 B
Go

package config
import "github.com/rs/zerolog"
// DirectAdminConfig represents DirectAdmin configuration.
type DirectAdminConfig struct {
URL string `env:"URL" envDefault:"https://s149.cyber-folks.pl:2223"`
User string `env:"USER,notEmpty"`
Token string `env:"TOKEN,notEmpty"`
}
// MarshalZerologObject implements zerolog.LogObjectMarshaler.
func (c *DirectAdminConfig) MarshalZerologObject(e *zerolog.Event) {
token := "[REDACTED]"
if len(c.Token) == 0 {
token = "[EMPTY]"
}
e.
Str("url", c.URL).
Str("user", c.User).
Str("token", token)
}
var (
_ zerolog.LogObjectMarshaler = &DirectAdminConfig{}
)