Fixes #29. Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
d26879a333
commit
2c3ca08dbf
9 changed files with 24 additions and 39 deletions
|
@ -10,7 +10,7 @@ type Config struct {
|
|||
Title string `json:"title"`
|
||||
DatabaseType string `json:"database_type"`
|
||||
DatabaseDsn string `json:"database_dsn"`
|
||||
IDLength int `json:"id_length"`
|
||||
NodeID int64 `json:"node_id"`
|
||||
PasswordLength int `json:"password_length"`
|
||||
ExpirationInterval int `json:"expiration_interval"`
|
||||
ListenAddress string `json:"listen_address"`
|
||||
|
@ -36,7 +36,7 @@ func NewConfig() *Config {
|
|||
Title: "Coller",
|
||||
DatabaseType: "sqlite",
|
||||
DatabaseDsn: "collerd.db",
|
||||
IDLength: 5,
|
||||
NodeID: 1,
|
||||
PasswordLength: 16,
|
||||
ExpirationInterval: 60, // 1 minute
|
||||
ListenAddress: "0.0.0.0",
|
||||
|
@ -88,8 +88,8 @@ func (c *Config) Check() error {
|
|||
}
|
||||
}
|
||||
|
||||
if c.IDLength <= 0 {
|
||||
return fmt.Errorf("identifiers length must be greater than zero")
|
||||
if c.NodeID < 0 || c.NodeID > 1023 {
|
||||
return fmt.Errorf("node id must be between 0 and 1023")
|
||||
}
|
||||
|
||||
if c.PasswordLength < internal.MIN_PASSWORD_LENGTH || c.PasswordLength > internal.MAX_PASSWORD_LENGTH {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue