Add a basic CLI

This commit is contained in:
Gabriel Adrian Samfira 2022-05-02 17:55:29 +00:00
parent 7ec937a138
commit 475d424f32
26 changed files with 930 additions and 102 deletions

View file

@ -28,16 +28,11 @@ type Authenticator struct {
}
func (a *Authenticator) IsInitialized() bool {
info, err := a.store.ControllerInfo()
if err != nil {
return false
if a.store.HasAdminUser(context.Background()) {
return true
}
if info.ControllerID.String() == "" {
return false
}
return true
return false
}
func (a *Authenticator) GetJWTToken(ctx context.Context) (string, error) {
@ -105,9 +100,6 @@ func (a *Authenticator) InitController(ctx context.Context, param params.NewUser
param.Password = hashed
if _, err := a.store.InitController(); err != nil {
return params.User{}, errors.Wrap(err, "initializing controller")
}
return a.store.CreateUser(ctx, param)
}