Added goals, cache and func to get any remote obj
Cache is for storage, also includes pooled encoders and decoders goals are things to eventually add to Linstrom
This commit is contained in:
parent
2977f09245
commit
8709238859
8 changed files with 907 additions and 16 deletions
|
@ -29,10 +29,6 @@ type ConfigGeneral struct {
|
|||
PrivatePort int `toml:"private_port"`
|
||||
// The port under which the public can reach the server (useful if running behind a reverse proxy)
|
||||
PublicPort *int `toml:"public_port"`
|
||||
// Url to the database to use. Can be a postgres url or the path to a sqlite file
|
||||
Database string `toml:"database"`
|
||||
// Whether the given database url is for a postgres server. If not set, assumes sqlite
|
||||
DbIsPostgres *bool `toml:"db_is_postgres"`
|
||||
}
|
||||
|
||||
type ConfigWebAuthn struct {
|
||||
|
@ -48,24 +44,38 @@ type ConfigAdmin struct {
|
|||
FirstTimeSetupOTP string `toml:"first_time_setup_otp"`
|
||||
}
|
||||
|
||||
type ConfigStorage struct {
|
||||
// Url to the database to use
|
||||
// If DbIsPostgres is either not set or false, the url is expected to be a path to a sqlite file
|
||||
// Otherwise, it's expected to be an url to a postgres server
|
||||
DatabaseUrl string `toml:"database_url"`
|
||||
// Whether the target of the database url is a postgres server
|
||||
DbIsPostgres *bool `toml:"db_is_postgres,omitempty"`
|
||||
// Whether to use Redis for caching in addition to an in memory one
|
||||
UseRedis bool `toml:"use_redis"`
|
||||
// Url to redis server. Expected to be set if UseRedis is true
|
||||
RedisUrl *string `toml:"redis_url,omitempty"`
|
||||
// The maximum size of the in-memory cache in bytes
|
||||
MaxInMemoryCacheSize int64 `toml:"max_in_memory_cache_size"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
General ConfigGeneral `toml:"general"`
|
||||
SSL ConfigSSL `toml:"ssl"`
|
||||
Admin ConfigAdmin `toml:"admin"`
|
||||
Webauthn ConfigWebAuthn `toml:"webauthn"`
|
||||
Storage ConfigStorage `toml:"storage"`
|
||||
}
|
||||
|
||||
var GlobalConfig Config
|
||||
|
||||
var defaultConfig Config = Config{
|
||||
General: ConfigGeneral{
|
||||
Protocol: "http",
|
||||
Subdomain: nil,
|
||||
Domain: "localhost",
|
||||
PrivatePort: 8080,
|
||||
PublicPort: nil,
|
||||
Database: "db.sqlite",
|
||||
DbIsPostgres: other.IntoPointer(false),
|
||||
Protocol: "http",
|
||||
Subdomain: nil,
|
||||
Domain: "localhost",
|
||||
PrivatePort: 8080,
|
||||
PublicPort: nil,
|
||||
},
|
||||
SSL: ConfigSSL{
|
||||
HandleSSL: false,
|
||||
|
@ -81,6 +91,13 @@ var defaultConfig Config = Config{
|
|||
DisplayName: "Linstrom",
|
||||
HashingSecret: "some super secure secret that should never be changed or else password storage breaks",
|
||||
},
|
||||
Storage: ConfigStorage{
|
||||
DatabaseUrl: "db.sqlite",
|
||||
DbIsPostgres: other.IntoPointer(false),
|
||||
UseRedis: false,
|
||||
RedisUrl: nil,
|
||||
MaxInMemoryCacheSize: 1e6, // 1 Megabyte
|
||||
},
|
||||
}
|
||||
|
||||
func (gc *ConfigGeneral) GetFullDomain() string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue