Use int instead of float64 in configs
Signed-off-by: arzumify <jliwin98@danwin1210.de>
This commit is contained in:
parent
8331219da4
commit
f0559ed5b5
4
main.go
4
main.go
|
@ -110,8 +110,8 @@ type Service struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompressionSettings struct {
|
type CompressionSettings struct {
|
||||||
Algorithm string `yaml:"algorithm" validate:"omitempty,oneof=gzip brotli zstd"`
|
Algorithm string `yaml:"algorithm" validate:"omitempty,oneof=gzip brotli zstd"`
|
||||||
Level float64 `yaml:"level" validate:"omitempty,min=1,max=22"`
|
Level int `yaml:"level" validate:"omitempty,min=1,max=22"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RouterAndCompression struct {
|
type RouterAndCompression struct {
|
||||||
|
|
|
@ -79,7 +79,7 @@ func addQuota(information library.ServiceInitializationInformation, message libr
|
||||||
respondError(err.Error(), information, true, message.ServiceID)
|
respondError(err.Error(), information, true, message.ServiceID)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, 0)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(float64))+message.Message.(nucleusLibrary.Quota).Bytes)
|
_, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, 0)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(int))+message.Message.(nucleusLibrary.Quota).Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
respondError(err.Error(), information, true, message.ServiceID)
|
respondError(err.Error(), information, true, message.ServiceID)
|
||||||
}
|
}
|
||||||
|
@ -109,11 +109,11 @@ func addReserved(information library.ServiceInitializationInformation, message l
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check if the user has enough space
|
// Check if the user has enough space
|
||||||
if int64(information.Configuration["defaultQuota"].(float64)) < message.Message.(nucleusLibrary.Quota).Bytes {
|
if int64(information.Configuration["defaultQuota"].(int)) < message.Message.(nucleusLibrary.Quota).Bytes {
|
||||||
respondError("insufficient storage", information, false, message.ServiceID)
|
respondError("insufficient storage", information, false, message.ServiceID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, $3)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(float64)), message.Message.(nucleusLibrary.Quota).Bytes)
|
_, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, $3)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(int)), message.Message.(nucleusLibrary.Quota).Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
respondError(err.Error(), information, true, message.ServiceID)
|
respondError(err.Error(), information, true, message.ServiceID)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue