mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-07 03:30:43 +01:00
Install now submits the proper database name and is properly set using the config.Value class. This extends the getter functionality so now config.Value can be used to both get and set values.
30 lines
507 B
Go
30 lines
507 B
Go
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package config
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
)
|
|
|
|
var setterMu sync.RWMutex
|
|
|
|
type DynKeySetter interface {
|
|
SetValue(ctx context.Context, dynKey, value string) error
|
|
}
|
|
|
|
var dynKeySetterInternal DynKeySetter
|
|
|
|
func SetDynSetter(p DynKeySetter) {
|
|
setterMu.Lock()
|
|
dynKeySetterInternal = p
|
|
setterMu.Unlock()
|
|
}
|
|
|
|
func GetDynSetter() DynKeySetter {
|
|
getterMu.RLock()
|
|
defer getterMu.RUnlock()
|
|
return dynKeySetterInternal
|
|
}
|