Unify JSON attribute naming ot use kebab style case. Cleanup configuration.

This commit is contained in:
2026-01-20 09:47:13 +01:00
parent d4edbd7d1a
commit 1d4c79c821
29 changed files with 200 additions and 203 deletions

View File

@@ -51,14 +51,10 @@ func setupSqlite(db *sql.DB) error {
return nil
}
func Connect(driver string, db string) {
func Connect(db string) {
var err error
var dbHandle *sqlx.DB
if driver != "sqlite3" {
cclog.Abortf("Unsupported database driver '%s'. Only 'sqlite3' is supported.\n", driver)
}
dbConnOnce.Do(func() {
opts := DatabaseOptions{
URL: db,
@@ -100,7 +96,7 @@ func Connect(driver string, db string) {
dbHandle.SetConnMaxLifetime(opts.ConnectionMaxLifetime)
dbHandle.SetConnMaxIdleTime(opts.ConnectionMaxIdleTime)
dbConnInstance = &DBConnection{DB: dbHandle, Driver: driver}
dbConnInstance = &DBConnection{DB: dbHandle}
err = checkDBVersion(dbHandle.DB)
if err != nil {
cclog.Abortf("DB Connection: Failed DB version check.\nError: %s\n", err.Error())

View File

@@ -26,7 +26,7 @@ func nodeTestSetup(t *testing.T) {
"main": {
"addr": "0.0.0.0:8080",
"validate": false,
"apiAllowedIPs": [
"api-allowed-ips": [
"*"
]
},
@@ -139,7 +139,7 @@ func nodeTestSetup(t *testing.T) {
}
archiveCfg := fmt.Sprintf("{\"kind\": \"file\",\"path\": \"%s\"}", jobarchive)
Connect("sqlite3", dbfilepath)
Connect(dbfilepath)
if err := archive.Init(json.RawMessage(archiveCfg)); err != nil {
t.Fatal(err)

View File

@@ -151,7 +151,7 @@ func setup(tb testing.TB) *JobRepository {
dbfile := "testdata/job.db"
err := MigrateDB(dbfile)
noErr(tb, err)
Connect("sqlite3", dbfile)
Connect(dbfile)
return GetJobRepository()
}

View File

@@ -20,7 +20,7 @@ func setupUserTest(t *testing.T) *UserCfgRepo {
const testconfig = `{
"main": {
"addr": "0.0.0.0:8080",
"apiAllowedIPs": [
"api-allowed-ips": [
"*"
]
},
@@ -36,7 +36,7 @@ func setupUserTest(t *testing.T) *UserCfgRepo {
if err != nil {
t.Fatal(err)
}
Connect("sqlite3", dbfilepath)
Connect(dbfilepath)
tmpdir := t.TempDir()
cfgFilePath := filepath.Join(tmpdir, "config.json")