create simple, bulletproof configuration scheme based on go-simpler/env

enables use of .env file and pre-specifying custom path to search for that and override
This commit is contained in:
2024-09-22 23:26:27 +01:00
parent f443d58fd7
commit 9977bb1cb8
9 changed files with 138 additions and 40 deletions

View File

@@ -52,9 +52,8 @@ var _ eventstore.I = (*T)(nil)
//
// Note that the cancel function for the context needs to be managed by the
// caller.
func GetBackend(Ctx context.T, WG *sync.WaitGroup, path S, hasL2 bool,
blockCacheSize, logLevel,
maxLimit int, params ...int) (b *T) {
func GetBackend(Ctx context.T, WG *sync.WaitGroup, hasL2 bool,
blockCacheSize, logLevel, maxLimit int, params ...int) (b *T) {
var sizeLimit, lw, hw, freq = 0, 86, 92, 60
switch len(params) {
case 4:
@@ -84,7 +83,6 @@ func GetBackend(Ctx context.T, WG *sync.WaitGroup, path S, hasL2 bool,
BlockCacheSize: blockCacheSize,
InitLogLevel: logLevel,
MaxLimit: maxLimit,
dataDir: path,
}
return
}