Skip to content

Commit b44a2ec

Browse files
authored
Merge pull request #5 from lost-rob0t/fix-settings
fix(settings): use constants and seperate defvars
2 parents b218198 + 087ddb1 commit b44a2ec

File tree

1 file changed

+57
-40
lines changed

1 file changed

+57
-40
lines changed

source/gserver-settings.lisp

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,62 @@
11
(in-package :star)
2-
;;; Version info
3-
(defparameter *star-server-version* "0.0.1")
4-
;;;; ** Gserver Settings
5-
;;;; *** Couchdb
6-
(defparameter *couchdb-host* (or (uiop:getenv "COUCHDB_HOST") "127.0.0.1") "The Couchdb host to use.
7-
Defaults to using ENV var $COUCHDB_HOST if set, or localhost ")
8-
(defparameter *couchdb-port* 5984 "The Couchdb port to use. Defaults to 5984")
9-
(defparameter *couchdb-default-database* (or (uiop:getenv "COUCHDB_DATABASE") "starintel") "the default database name to use.")
102

11-
(defparameter *couchdb-auth-database* "starintel-gserver-auth")
12-
(defparameter *couchdb-scheme* "http" "what http scheme to use. set to http or https")
13-
(defparameter *couchdb-user* (or (uiop:getenv "COUCHDB_USER") "admin") "couchdb user")
14-
(defparameter *couchdb-password* (or (uiop:getenv "COUCHDB_PASSWORD") "password") "couchdb user password")
15-
;;;; By Default the views in starintel-gserver/views will be installed, but you can append your own to this setting to have it created at startup.
16-
(defparameter *couchdb-views* (let ((files (uiop:directory-files (uiop:merge-pathnames* "views/" (asdf:system-source-directory :starintel-gserver)))))
17-
(loop for file in files
18-
collect (with-open-file (str file)
19-
(read-line str))))
20-
"List of views to install into couchdb.")
3+
(defparameter +default-couchdb-host+ "127.0.0.1")
4+
(defparameter +default-couchdb-port+ 5984)
5+
(defparameter +default-couchdb-default-database+ "starintel")
6+
(defparameter +default-couchdb-user+ "admin")
7+
(defparameter +default-couchdb-password+ "password")
8+
(defparameter +default-http-api-address+ "localhost")
9+
(defparameter +default-rabbit-address+ "localhost")
10+
(defparameter +default-rabbit-port+ 5672)
11+
(defparameter +default-rabbit-user+ "guest")
12+
(defparameter +default-rabbit-password+ "guest")
13+
(defparameter +default-slynk-port+ 4009)
2114

22-
;;;; *** HTTP API
23-
(defparameter *http-api-address* (or (uiop:getenv "HTTP_API_LISTEN_ADDRESS") "localhost") "the listen address")
24-
(defparameter *http-api-port* 5000 "the port the api server listen on")
25-
(defparameter *http-api-base-path* "/api" "the base url to use for the api endpoint")
26-
(defparameter *http-cert-file* nil "path to the http api cert providing https")
27-
(defparameter *http-key-file* nil "path to the http cert providing https")
28-
(defparameter *http-scheme* 'http "use https or not.")
15+
(defparameter *couchdb-host* +default-couchdb-host+
16+
"The Couchdb host to use. Uses ENV var COUCHDB_HOST if set.")
17+
(defparameter *couchdb-port* +default-couchdb-port+
18+
"The Couchdb port to use. Defaults to 5984.")
19+
(defparameter *couchdb-default-database* +default-couchdb-default-database+
20+
"The default database name to use.")
21+
(defparameter *couchdb-user* +default-couchdb-user+
22+
"Couchdb user name.")
23+
(defparameter *couchdb-password* +default-couchdb-password+
24+
"Couchdb user password.")
2925

30-
;;;; *** RabbitMQ
31-
(defparameter *rabbit-address* (or (uiop:getenv "RABBITMQ_ADDRESS") "localhost") "The address rabbitmq is running on.")
32-
(defparameter *rabbit-port* 5672 "The port that rabbitmq is listening on.")
33-
(defparameter *rabbit-user* "guest" "the username for rabbimq")
34-
(defparameter *rabbit-password* "guest" "the password for the rabbitmq user.")
35-
(defparameter *slynk-port* 4009 "Port to use for SLYNK remote debugging")
26+
(defparameter *couchdb-views*
27+
(when (asdf:system-source-directory :starintel-gserver)
28+
(let* ((views-dir (uiop::merge-pathnames* "views/" (asdf:system-source-directory :starintel-gserver))))
29+
(when (probe-file views-dir)
30+
(loop for file in (uiop:directory-files views-dir)
31+
collect (with-open-file (str (uiop:merge-pathnames* file views-dir))
32+
(read-line str))))))
33+
"List of views to install into Couchdb.")
3634

37-
;;;; *** Actors
38-
;;;; Hooks are implemented Via nhooks you can read documentation here for how to add hooks. https://github.com/atlas-engineer/nhooks
39-
(defparameter *actors-start-hook* (make-instance 'nhooks:hook-void) "Actor startup hook.")
40-
;;;; *** Patterns
41-
;;;; Patterns are
42-
(defparameter *document-patterns* () "A List of document patterns created by defpattern")
43-
(defparameter *injest-workers* 4 "Number of workers for handling documents, set to 4 by default.")
44-
;;;; *** actor event log
45-
(defparameter *couchdb-event-log-database* "starintel-event-source" "The name of the database to be used for event logs.")
35+
;; HTTP API configuration
36+
(defparameter *http-api-address* +default-http-api-address+
37+
"The address on which the HTTP API listens.")
38+
(defparameter *http-api-port* 5000 "Port for the HTTP API.")
39+
(defparameter *http-api-base-path* "/api" "Base URL for the API endpoint.")
40+
(defparameter *http-cert-file* nil "Path to the HTTPS cert file.")
41+
(defparameter *http-key-file* nil "Path to the HTTPS key file.")
42+
(defparameter *http-scheme* 'http "HTTP scheme to use (http or https).")
43+
44+
;; RabbitMQ configuration
45+
(defparameter *rabbit-address* +default-rabbit-address+
46+
"The RabbitMQ host.")
47+
(defparameter *rabbit-port* +default-rabbit-port+
48+
"The port for RabbitMQ.")
49+
(defparameter *rabbit-user* +default-rabbit-user+
50+
"The RabbitMQ user name.")
51+
(defparameter *rabbit-password* +default-rabbit-password+
52+
"The RabbitMQ user password.")
53+
54+
;; Other configurations
55+
(defparameter *slynk-port* +default-slynk-port+
56+
"Port to use for SLYNK remote debugging.")
57+
(defparameter *actors-start-hook* (make-instance 'nhooks:hook-void)
58+
"Actor startup hook.")
59+
(defparameter *document-patterns* () "A list of document patterns created by defpattern.")
60+
(defparameter *injest-workers* 4 "Number of workers for handling documents.")
61+
(defparameter *couchdb-event-log-database* "starintel-event-source"
62+
"The database name used for event logs.")

0 commit comments

Comments
 (0)