From 2e8c3d805690fce6d19fffb4ba024e1989c18825 Mon Sep 17 00:00:00 2001 From: colin Date: Sun, 11 Aug 2024 20:37:54 -0700 Subject: Fixes --- build.lisp | 28 +++++++++++++++++----------- pastiche.conf | 8 ++++---- pastiche.lisp | 15 +++------------ 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/build.lisp b/build.lisp index 98920ea..a883eaa 100644 --- a/build.lisp +++ b/build.lisp @@ -4,21 +4,27 @@ (defun get-option (name &optional default) (or - (let ((args (uiop:command-line-arguments))) - (when-let ((pos (position name args :test #'string-equal))) - (nth (1+ pos) args))) - default)) + (let* ((args (uiop:command-line-arguments)) + (pos (position name args :test #'string-equal))) + (or (nth (1+ pos) args) + default)))) (defun run () - (let ((config-path (get-option "--config"))) - (truname config-path) - (pastiche::load-config config-path) - (pastiche::start) - (loop (sleep 30)))) + (format t "STARTING PASTICHE~%") + (handler-case + (let ((config-path (get-option "--config"))) + (truename config-path) + (format t "LOADING CONFIG ~%") + (pastiche::load-config config-path) + (format t "STARTING PASTICHE") + (pastiche::start)) + (error (e) + (format *error-output* "~a~%" e) + (uiop:quit))) + (loop (sleep 30))) (ensure-directories-exist #P"./bin/") (sb-ext:save-lisp-and-die "bin/pastiche" :toplevel #'run - :executable t - :compression t) + :executable t) diff --git a/pastiche.conf b/pastiche.conf index aaf3fd4..b9160d0 100644 --- a/pastiche.conf +++ b/pastiche.conf @@ -1,6 +1,6 @@ -(:service-domain "paste.cicadas.surf" +(:service-domain "paste.mycooldomain.com" :service-protocol "https" - :service-port 80 - :localhost-port 9911 :db-path "/home/pastiche/db/" - :paste-path "/home/pastiche/pastes/") \ No newline at end of file + :paste-path "/home/pastiche/pastes/" + :service-port 80 + :localhost-port 8989) \ No newline at end of file diff --git a/pastiche.lisp b/pastiche.lisp index 1ca4807..e5141ae 100644 --- a/pastiche.lisp +++ b/pastiche.lisp @@ -29,7 +29,6 @@ :initform (error "Missing required slot")) ((localhost-port "Port on which the HTTP server should listen.") (service-port "Port that should be mentioned in URLs generated by the app.") - (ttl "The default time-to-live, in milliseconds") :ro :type integer :initform (error "Missing required slot")) @@ -53,9 +52,6 @@ (defun paste-path* () (paste-path *config*)) -(defun ttl* () - (ttl *config*)) - (defun load-config (path) "Loads a PLIST from disk from PATH. @@ -65,8 +61,7 @@ E.g. you'd put this in a file. :service-protocol 8989 :db-path \"/absolute/path/to/a/directory/\", :paste-path \"/absolute/path/to/another/directory/\", - :server-port 8000 - :ttl 7776000)" + :server-port 8000)" (destructuring-bind (&key service-domain @@ -74,8 +69,7 @@ E.g. you'd put this in a file. service-port localhost-port db-path - paste-path - ttl) + paste-path) (uiop:read-file-form path) (setf *config* (make-instance 'config @@ -84,8 +78,7 @@ E.g. you'd put this in a file. :service-port service-port :localhost-port localhost-port :db-path db-path - :paste-path paste-path - :ttl ttl)))) + :paste-path paste-path)))) (defun start () (unless *config* @@ -111,7 +104,6 @@ E.g. you'd put this in a file. (def:class paste (db:store-object) ((title "A name for this paste. Used to generate file name on disk.") - (content "The text of this paste") (filename "Filename relative to CONFIG's PASTE-PATH") :type string :initform (error "Missing required slot") @@ -206,7 +198,6 @@ from make-paste-filename.")) :pinned nil :privacy :unlisted :paste-time (get-universal-time) - :content content :title title :filename location)) -- cgit v1.2.3