cleanup merge

This commit is contained in:
Livio Spring 2023-09-05 07:18:47 +02:00
parent 38f7b1bd06
commit 3b0be67627
No known key found for this signature in database
GPG Key ID: 26BB1C2FA5952CF0

View File

@ -91,26 +91,3 @@ func secretGeneratorConfigWithDefault(ctx context.Context, filter preparation.Fi
IncludeSymbols: wm.IncludeSymbols,
}, nil
}
func secretGeneratorConfigWithDefault(ctx context.Context, filter preparation.FilterToQueryReducer, typ domain.SecretGeneratorType, defaultGenerator *crypto.GeneratorConfig) (*crypto.GeneratorConfig, error) {
wm := NewInstanceSecretGeneratorConfigWriteModel(ctx, typ)
events, err := filter(ctx, wm.Query())
if err != nil {
return nil, err
}
wm.AppendEvents(events...)
if err := wm.Reduce(); err != nil {
return nil, err
}
if wm.State != domain.SecretGeneratorStateActive {
return defaultGenerator, nil
}
return &crypto.GeneratorConfig{
Length: wm.Length,
Expiry: wm.Expiry,
IncludeLowerLetters: wm.IncludeLowerLetters,
IncludeUpperLetters: wm.IncludeUpperLetters,
IncludeDigits: wm.IncludeDigits,
IncludeSymbols: wm.IncludeSymbols,
}, nil
}