fix: Change default silk db path to /var/silk
All checks were successful
gitea-sync/silk/pipeline/head This commit looks good

This commit is contained in:
DanyLE 2024-03-13 18:20:46 +01:00
parent bf5284e66f
commit 6380787d7e
3 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,5 @@
# initialise autoconf and set up some basic information about the program were packaging
AC_INIT([silk], [0.1.0], [xsang.le@gmail.com])
AC_INIT([silk], [0.1.1], [xsang.le@gmail.com])
# Were going to use automake for this project
# [subdir-objects] if needed

View File

@ -4,7 +4,7 @@ math.randomseed(os.time())
__api__ = {
apiroot = string.format("%s/lua", _SERVER["LIB_DIR"]),
tmpdir = _SERVER["TMP_DIR"],
dbpath = _SERVER["DB_DIR"]
dbpath = "/var/silk"
}
-- root dir
__ROOT__ = _SERVER["DOCUMENT_ROOT"]

View File

@ -13,6 +13,13 @@ sqlite.getdb = function(name)
LOG_ERROR("Invalid database name %s", name)
return nil
else
-- default db path is /var/silk/
if not ulib.exists(__api__.dbpath) then
if not ulib.mkdir(__api__.dbpath) then
LOG_ERROR("Unable to create DB path: %s", __api__.dbpath)
return nil
end
end
return sqlite.db(__api__.dbpath .. "/" .. name .. ".db")
end
end