mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-15 17:52:59 +03:00
feat: add support for ECDSA and EdDSA keys (#359)
Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
committed by
GitHub
parent
5c198c280c
commit
96876a99c5
@@ -2,6 +2,7 @@ package model
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type AppConfigVariable struct {
|
||||
@@ -13,11 +14,21 @@ type AppConfigVariable struct {
|
||||
DefaultValue string
|
||||
}
|
||||
|
||||
// IsTrue returns true if the value is a truthy string, such as "true", "t", "yes", "1", etc.
|
||||
func (a *AppConfigVariable) IsTrue() bool {
|
||||
ok, _ := strconv.ParseBool(a.Value)
|
||||
return ok
|
||||
}
|
||||
|
||||
// AsDurationMinutes returns the value as a time.Duration, interpreting the string as a whole number of minutes.
|
||||
func (a *AppConfigVariable) AsDurationMinutes() time.Duration {
|
||||
val, err := strconv.Atoi(a.Value)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return time.Duration(val) * time.Minute
|
||||
}
|
||||
|
||||
type AppConfig struct {
|
||||
// General
|
||||
AppName AppConfigVariable
|
||||
|
||||
Reference in New Issue
Block a user