切换存储方式
This commit is contained in:
12
config.go
12
config.go
@@ -24,7 +24,7 @@ type Config struct {
|
||||
Bind string `yaml:"bind"` // HTTP 绑定
|
||||
Domain string `yaml:"domain"` // 基础域名
|
||||
|
||||
Config string `yaml:"config"` // 配置
|
||||
Database ConfigDatabase `yaml:"database"` // 配置
|
||||
|
||||
Auth ConfigAuth `yaml:"auth"` // 后端认证配置
|
||||
|
||||
@@ -46,7 +46,7 @@ func (c *Config) NewPageServerOptions() (*pkg.ServerOptions, error) {
|
||||
}
|
||||
var err error
|
||||
|
||||
if c.Config == "" {
|
||||
if c.Database.URL == "" {
|
||||
return nil, errors.New("config is required")
|
||||
}
|
||||
if c.StaticDir != "" {
|
||||
@@ -88,7 +88,7 @@ func (c *Config) NewPageServerOptions() (*pkg.ServerOptions, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "create cache")
|
||||
}
|
||||
alias, err := kv.NewKVFromURL(c.Config)
|
||||
alias, err := kv.NewKVFromURL(c.Database.URL)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to init alias config")
|
||||
}
|
||||
@@ -105,7 +105,7 @@ func (c *Config) NewPageServerOptions() (*pkg.ServerOptions, error) {
|
||||
CacheBlob: memoryCache,
|
||||
CacheBlobTTL: c.Cache.BlobTTL,
|
||||
CacheBlobLimit: uint64(c.Cache.BlobLimit),
|
||||
HttpClient: http.DefaultClient,
|
||||
HTTPClient: http.DefaultClient,
|
||||
EnableRender: c.Render.Enable,
|
||||
EnableProxy: c.Proxy.Enable,
|
||||
StaticDir: c.StaticDir,
|
||||
@@ -151,6 +151,10 @@ type ConfigPage struct {
|
||||
ErrUnknownPage string `yaml:"500"`
|
||||
}
|
||||
|
||||
type ConfigDatabase struct {
|
||||
URL string `yaml:"url"`
|
||||
}
|
||||
|
||||
type ConfigProxy struct {
|
||||
Enable bool `yaml:"enable"` // 是否允许反向代理
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user