ctucx.git: oeffi-web

[nimlang] oeffisearch fork that works without javascript

commit 50250906d1923fc4607014f28d9d8e1bfe169c79
parent f83c4d2742def6b400321028b57aeb2e5bbc7cd8
Author: Leah Thein <leah@toaster.fritz.box>
Date: Sat, 5 Dec 2020 08:20:38 +0100

option to write current pid to a file
1 file changed, 9 insertions(+), 2 deletions(-)
M
src/oeffi_nojs.nim
|
11
+++++++++--
diff --git a/src/oeffi_nojs.nim b/src/oeffi_nojs.nim
@@ -13,7 +13,7 @@ import endpoints/api/journeys
 import endpoints/api/moreJourneys
 import endpoints/api/refreshJourney
 
-import utils, translations, types, cache_types, cache, backend/hafas, formaters/formaters
+import types, backend/hafas, formaters/formaters
 
 
 proc CtrlCHook() {.noconv.} =

@@ -29,10 +29,17 @@ proc main =  # for gcsafe
 
   if getEnv("CACHE_PATH") == "":
     echo "CACHE_PATH not set! Bye...."
-    quit()
+    quit(1)
   else:
     discard existsOrCreateDir(getEnv("CACHE_PATH"))
 
+  if getEnv("PID_FILE") != "":
+    try:
+      writeFile(getEnv("PID_FILE"), $getpid())
+    except:
+      echo "Can't write pid file!"
+      quit(1)
+
   var server = newServer()  # launch on http://localhost:5000
 
   server.pages: