alist/conf/config.go

55 lines
1.3 KiB
Go
Raw Normal View History

2021-10-25 10:53:59 +00:00
package conf
type Database struct {
Type string `json:"type"`
User string `json:"user"`
Password string `json:"password"`
Host string `json:"host"`
Port int `json:"port"`
Name string `json:"name"`
TablePrefix string `json:"table_prefix"`
DBFile string `json:"db_file"`
2022-01-19 01:14:31 +00:00
SslMode string `json:"ssl_mode"`
2021-10-25 10:53:59 +00:00
}
2021-12-30 12:42:37 +00:00
type Scheme struct {
Https bool `json:"https"`
CertFile string `json:"cert_file"`
KeyFile string `json:"key_file"`
}
type CacheConfig struct {
Expiration int64 `json:"expiration"`
CleanupInterval int64 `json:"cleanup_interval"`
}
2021-10-25 10:53:59 +00:00
type Config struct {
2021-12-30 12:42:37 +00:00
Address string `json:"address"`
Port int `json:"port"`
2022-01-14 12:10:35 +00:00
Assets string `json:"assets"`
2021-12-30 12:42:37 +00:00
Database Database `json:"database"`
Scheme Scheme `json:"scheme"`
Cache CacheConfig `json:"cache"`
2022-02-14 07:06:57 +00:00
TempDir string `json:"temp_dir"`
2021-10-25 10:53:59 +00:00
}
func DefaultConfig() *Config {
return &Config{
Address: "0.0.0.0",
Port: 5244,
2022-02-20 07:14:18 +00:00
Assets: "https://npm.elemecdn.com/alist-web@$version",
2022-02-14 07:06:57 +00:00
TempDir: "data/temp",
2021-10-25 10:53:59 +00:00
Database: Database{
Type: "sqlite3",
Port: 0,
TablePrefix: "x_",
2021-11-13 06:23:41 +00:00
DBFile: "data/data.db",
2022-01-19 01:14:31 +00:00
SslMode: "disable",
2021-10-25 10:53:59 +00:00
},
2021-12-30 12:42:37 +00:00
Cache: CacheConfig{
Expiration: 60,
CleanupInterval: 120,
},
2021-10-25 10:53:59 +00:00
}
}