add missing commands and unify service / namespace options
This commit is contained in:
@@ -381,7 +381,7 @@ func (s Service) CreateAccount(ctx context.Context, in *proto.CreateAccountReque
|
||||
if out.PasswordProfile != nil {
|
||||
if out.PasswordProfile.Password != "" {
|
||||
// encrypt password
|
||||
hashed, err := bcrypt.GenerateFromPassword([]byte(in.Account.PasswordProfile.Password), s.Config.Server.HashDifficulty)
|
||||
hashed, err := bcrypt.GenerateFromPassword([]byte(in.Account.PasswordProfile.Password), s.Config.HashDifficulty)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Str("id", id).Msg("could not hash password")
|
||||
return merrors.InternalServerError(s.id, "could not hash password: %v", err.Error())
|
||||
@@ -572,7 +572,7 @@ func (s Service) UpdateAccount(ctx context.Context, in *proto.UpdateAccountReque
|
||||
}
|
||||
if in.Account.PasswordProfile.Password != "" {
|
||||
// encrypt password
|
||||
hashed, err := bcrypt.GenerateFromPassword([]byte(in.Account.PasswordProfile.Password), s.Config.Server.HashDifficulty)
|
||||
hashed, err := bcrypt.GenerateFromPassword([]byte(in.Account.PasswordProfile.Password), s.Config.HashDifficulty)
|
||||
if err != nil {
|
||||
in.Account.PasswordProfile.Password = ""
|
||||
s.log.Error().Err(err).Str("id", id).Msg("could not hash password")
|
||||
|
||||
@@ -32,7 +32,7 @@ var (
|
||||
|
||||
func init() {
|
||||
cfg := config.New()
|
||||
cfg.Server.Name = "accounts"
|
||||
cfg.Service.Name = "accounts"
|
||||
cfg.Repo.Backend = "disk"
|
||||
cfg.Repo.Disk.Path = dataPath
|
||||
logger := olog.NewLogger(olog.Color(true), olog.Pretty(true))
|
||||
|
||||
@@ -57,7 +57,7 @@ func New(opts ...Option) (s *Service, err error) {
|
||||
}
|
||||
|
||||
s = &Service{
|
||||
id: cfg.GRPC.Namespace + "." + cfg.Server.Name,
|
||||
id: cfg.GRPC.Namespace + "." + cfg.Service.Name,
|
||||
log: logger,
|
||||
Config: cfg,
|
||||
RoleService: roleService,
|
||||
@@ -81,11 +81,11 @@ func New(opts ...Option) (s *Service, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = s.createDefaultAccounts(cfg.Server.DemoUsersAndGroups); err != nil {
|
||||
if err = s.createDefaultAccounts(cfg.DemoUsersAndGroups); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = s.createDefaultGroups(cfg.Server.DemoUsersAndGroups); err != nil {
|
||||
if err = s.createDefaultGroups(cfg.DemoUsersAndGroups); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user