feat: Rename password by encryption key
All checks were successful
/ pre-commit (push) Successful in 1m9s
All checks were successful
/ pre-commit (push) Successful in 1m9s
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
634326190c
commit
8e1dd686d3
16 changed files with 118 additions and 117 deletions
|
@ -11,7 +11,7 @@ type Config struct {
|
|||
DatabaseType string `json:"database_type"`
|
||||
DatabaseDsn string `json:"database_dsn"`
|
||||
NodeID int64 `json:"node_id"`
|
||||
PasswordLength int `json:"password_length"`
|
||||
EncryptionKeyLength int `json:"encryption_key_length"`
|
||||
ExpirationInterval int `json:"expiration_interval"`
|
||||
ListenAddress string `json:"listen_address"`
|
||||
ListenPort int `json:"listen_port"`
|
||||
|
@ -33,14 +33,14 @@ type Config struct {
|
|||
|
||||
func NewConfig() *Config {
|
||||
return &Config{
|
||||
Title: "Coller",
|
||||
DatabaseType: "sqlite",
|
||||
DatabaseDsn: "collerd.db",
|
||||
NodeID: 1,
|
||||
PasswordLength: 16,
|
||||
ExpirationInterval: 60, // 1 minute
|
||||
ListenAddress: "0.0.0.0",
|
||||
ListenPort: 8080,
|
||||
Title: "Coller",
|
||||
DatabaseType: "sqlite",
|
||||
DatabaseDsn: "collerd.db",
|
||||
NodeID: 1,
|
||||
EncryptionKeyLength: 16,
|
||||
ExpirationInterval: 60, // 1 minute
|
||||
ListenAddress: "0.0.0.0",
|
||||
ListenPort: 8080,
|
||||
Expirations: []int{
|
||||
300, // 5 minutes
|
||||
3600, // 1 hour
|
||||
|
@ -92,8 +92,8 @@ func (c *Config) Check() error {
|
|||
return fmt.Errorf("node id must be between 0 and 1023")
|
||||
}
|
||||
|
||||
if c.PasswordLength < internal.MIN_PASSWORD_LENGTH || c.PasswordLength > internal.MAX_PASSWORD_LENGTH {
|
||||
return fmt.Errorf("password length must be between %d and %d", internal.MIN_PASSWORD_LENGTH, internal.MAX_PASSWORD_LENGTH)
|
||||
if c.EncryptionKeyLength < internal.MIN_ENCRYPTION_KEY_LENGTH || c.EncryptionKeyLength > internal.MAX_ENCRYPTION_KEY_LENGTH {
|
||||
return fmt.Errorf("encryption key length must be between %d and %d", internal.MIN_ENCRYPTION_KEY_LENGTH, internal.MAX_ENCRYPTION_KEY_LENGTH)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue