introduce deplyoment config
[rrq/hourglass.git] / control-logic.lsp
index c842c06eee67d320d6270d87548e66ec80baf1b6..d75a9133a629e0fe46a2d24b9f0c8fe8baa52311 100644 (file)
@@ -9,7 +9,14 @@
   (write-line 2 (join (map string args)))
   (exit 1))
 
-(constant 'NOW (date-value))
+(constant
+ 'NOW (date-value)
+ 'ACTDIR SITE:listener.activity.dir
+ 'CONTROL.DAT SITE:control.dat
+ 'EXTRA.DAT SITE:control.extra.dat
+ 'USAGE.DAT SITE:usage.dat
+ 'USAGE.TMP SITE:usage.tmp
+ )
 
 # Set current time variables in local timezone
 (map set '(YEAR MONTH DATE HOUR MINUTE SECOND DOY DOW)
  DAY (list YEAR MONTH DATE)
  HM (list HOUR MINUTE)
  TOTAL '()
- CONTROL.DAT "control.dat"
- EXTRA.DAT "control-extra.dat"
- USAGE.DAT "usage.dat"
- USAGE.TMP ".usage.dat" 
  )
 
 # Load CONTROL.DAT
@@ -40,7 +43,6 @@
 (setf
  GAP (or (lookup 'gap CONTROL) 15)
  CLIP (or (lookup 'clip CONTROL) 1000)
- NET  (or (lookup 'net CONTROL) "10.0.0.0/8")
  )
 
 # Load the configured control mechanism
 ;;==== Utilities for activity data
 # Activity is lines of timestamps. Collect TOTAL as list of unique
 # time values (H M) within the start-end time span.
+
 (define (log-name-fmt t)
   (format "%d%02d%02d-.*\\.dat" (0 3 (date-list t))))
 
 (define (log-lines f)
-  (find-all "([0-9]+( \\S+)?).*" (read-file (string "activity/" f)) $1 0))
+  (find-all "([0-9]+( \\S+)?).*" (read-file (format "%s/%s" ACTDIR f)) $1 0))
 
 # Collect all timestamps of the UTC date of the given time stamp
 (define (logs t)
-  (flat (map log-lines (directory "activity" (log-name-fmt t)))))
+  (flat (map log-lines (directory ACTDIR (log-name-fmt t)))))
 
 # Translate timestamp into its local time (hour minute), if it's
 # within the applicable day, null otherwise.