diff options
Diffstat (limited to 'src/main.lisp')
| -rw-r--r-- | src/main.lisp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/main.lisp b/src/main.lisp index 712b25d..f9720c9 100644 --- a/src/main.lisp +++ b/src/main.lisp | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | (:use :c2cl :ukkoclot/config :ukkoclot/inline-bots :ukkoclot/tg) | 5 | (:use :c2cl :ukkoclot/config :ukkoclot/inline-bots :ukkoclot/tg) |
| 6 | (:import-from :anaphora :acond :awhen :it) | 6 | (:import-from :anaphora :acond :awhen :it) |
| 7 | (:import-from :log) | 7 | (:import-from :log) |
| 8 | (:import-from :swank) | ||
| 9 | (:import-from :ukkoclot/db :with-db) | 8 | (:import-from :ukkoclot/db :with-db) |
| 10 | (:import-from :ukkoclot/serializing :fixup-value) | 9 | (:import-from :ukkoclot/serializing :fixup-value) |
| 11 | (:import-from :ukkoclot/state :make-bot :bot-config :bot-power-on) | 10 | (:import-from :ukkoclot/state :make-bot :bot-config :bot-power-on) |
| @@ -24,19 +23,6 @@ | |||
| 24 | (error (err) (report-error bot ,evt err))) | 23 | (error (err) (report-error bot ,evt err))) |
| 25 | (progn ,@body))) | 24 | (progn ,@body))) |
| 26 | 25 | ||
| 27 | (defun start-swank (port) | ||
| 28 | (log:info "Starting a SWANK server on port ~A..." port) | ||
| 29 | (swank:create-server :port port :dont-close t) | ||
| 30 | (log:info | ||
| 31 | "SWANK started. You can connect to it by forwarding ports via SSH: `ssh -L~A:127.0.0.1:~A username@server.com'" | ||
| 32 | port port) | ||
| 33 | (log:info "And then afterwards M-x slime-connect giving localhost and ~A" port)) | ||
| 34 | |||
| 35 | (defun stop-swank (port) | ||
| 36 | (log:info "Stopping the SWANK server on port ~A..." port) | ||
| 37 | (swank:stop-server port) | ||
| 38 | (log:info "Done")) | ||
| 39 | |||
| 40 | (defun main () | 26 | (defun main () |
| 41 | (log:config :debug) | 27 | (log:config :debug) |
| 42 | (unwind-protect | 28 | (unwind-protect |
| @@ -50,12 +36,11 @@ | |||
| 50 | (defun main-with-config (config) | 36 | (defun main-with-config (config) |
| 51 | (unwind-protect | 37 | (unwind-protect |
| 52 | (progn | 38 | (progn |
| 53 | (start-swank (config-swank-port config)) | ||
| 54 | (with-db (db (config-db-path config)) | 39 | (with-db (db (config-db-path config)) |
| 55 | (let ((bot (make-bot config db))) | 40 | (let ((bot (make-bot config db))) |
| 56 | ;; TODO: Catch fatal errors & report them | 41 | ;; TODO: Catch fatal errors & report them |
| 57 | (wrapped-main bot config)))) | 42 | (wrapped-main bot config)))) |
| 58 | (stop-swank (config-swank-port config)))) | 43 | (log:info "We're done!"))) |
| 59 | 44 | ||
| 60 | (defun wrapped-main (bot config) | 45 | (defun wrapped-main (bot config) |
| 61 | (when *in-prod* | 46 | (when *in-prod* |