Make write-ahead-log default and configurable for sqlite (#1985)
* correctly enable WAL log for sqlite this commit makes headscale correctly enable write-ahead-log for sqlite and adds an option to turn it on and off. WAL is enabled by default and should make sqlite perform a lot better, even further eliminating the need to use postgres. It also adds a couple of other useful defaults. Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> * update changelog Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> --------- Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
8f8f469c0a
commit
4a34cfc4a6
4 changed files with 28 additions and 3 deletions
|
@ -81,7 +81,8 @@ type Config struct {
|
|||
}
|
||||
|
||||
type SqliteConfig struct {
|
||||
Path string
|
||||
Path string
|
||||
WriteAheadLog bool
|
||||
}
|
||||
|
||||
type PostgresConfig struct {
|
||||
|
@ -222,6 +223,8 @@ func LoadConfig(path string, isFile bool) error {
|
|||
viper.SetDefault("database.postgres.max_idle_conns", 10)
|
||||
viper.SetDefault("database.postgres.conn_max_idle_time_secs", 3600)
|
||||
|
||||
viper.SetDefault("database.sqlite.write_ahead_log", true)
|
||||
|
||||
viper.SetDefault("oidc.scope", []string{oidc.ScopeOpenID, "profile", "email"})
|
||||
viper.SetDefault("oidc.strip_email_domain", true)
|
||||
viper.SetDefault("oidc.only_start_if_oidc_is_available", true)
|
||||
|
@ -443,6 +446,7 @@ func GetDatabaseConfig() DatabaseConfig {
|
|||
Path: util.AbsolutePathFromConfigPath(
|
||||
viper.GetString("database.sqlite.path"),
|
||||
),
|
||||
WriteAheadLog: viper.GetBool("database.sqlite.write_ahead_log"),
|
||||
},
|
||||
Postgres: PostgresConfig{
|
||||
Host: viper.GetString("database.postgres.host"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue