diff semiconginev2/contrib/settings.nim @ 1252:01e9f41d35b1

add:support for push constants
author sam <sam@basx.dev>
date Fri, 26 Jul 2024 23:04:01 +0700
parents c8e3037aca66
children
line wrap: on
line diff
--- a/semiconginev2/contrib/settings.nim	Fri Jul 26 20:34:02 2024 +0700
+++ b/semiconginev2/contrib/settings.nim	Fri Jul 26 23:04:01 2024 +0700
@@ -1,9 +1,8 @@
-const CONFIGROOT: string = "."
-const CONFIGEXTENSION: string = "ini"
-# by default enable hot-reload of runtime-configuration only in debug builds
-const CONFIGHOTRELOAD: bool = not defined(release)
-# milliseconds to wait between checks for settings hotreload
-const CONFIGHOTRELOADINTERVAL: int = 1000
+const CONFIGHOTRELOAD {.booldefine.}: bool = not defined(release)
+const CONFIGHOTRELOADINTERVAL {.intdefine.}: int = 1000
+const CONFIGROOT {.strdefine.}: string = "."
+const CONFIGEXTENSION {.strdefine.}: string = "ini"
+
 
 when CONFIGHOTRELOAD:
   var
@@ -77,8 +76,6 @@
 allsettings = loadAllConfig()
 
 when CONFIGHOTRELOAD == true:
-  import std/times
-
   proc configFileWatchdog() {.thread.} =
     var configModTimes: Table[string, times.Time]
     while true:
@@ -93,8 +90,3 @@
       sleep CONFIGHOTRELOADINTERVAL
   var thethread: Thread[void]
   createThread(thethread, configFileWatchdog)
-
-if not defined(release):
-  setLogFilter(lvlAll)
-else:
-  setLogFilter(lvlWarn)