github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/api/latest/monitoring/admin/admin.go (about) 1 package admin 2 3 import ( 4 "github.com/caos/orbos/pkg/secret" 5 ) 6 7 // Admin: Not defining the admin credentials results in an user admin with password admin. 8 type Admin struct { 9 Username *secret.Secret `json:"username,omitempty" yaml:"username,omitempty"` 10 Password *secret.Secret `json:"password,omitempty" yaml:"password,omitempty"` 11 //Existing Secret containing username and password 12 ExistingUsername *secret.Existing `json:"existingUsername,omitempty" yaml:"existingUsername,omitempty"` 13 ExistingPassword *secret.Existing `json:"existingPassword,omitempty" yaml:"existingPassword,omitempty"` 14 } 15 16 func (a *Admin) IsZero() bool { 17 if (a.Username == nil || a.Username.IsZero()) && 18 (a.Password == nil || a.Password.IsZero()) && 19 (a.ExistingUsername == nil || a.ExistingUsername.IsZero()) && 20 (a.ExistingPassword == nil || a.ExistingPassword.IsZero()) { 21 return true 22 } 23 return false 24 } 25 26 func (a *Admin) InitSecrets() { 27 if a.Username == nil { 28 a.Username = &secret.Secret{} 29 } 30 if a.ExistingUsername == nil { 31 a.ExistingUsername = &secret.Existing{} 32 } 33 if a.Password == nil { 34 a.Password = &secret.Secret{} 35 } 36 if a.ExistingPassword == nil { 37 a.ExistingPassword = &secret.Existing{} 38 } 39 }