Compare commits
No commits in common. "9042e78ae898d3c32e17c0c4a843203a265369ef" and "17882bb82c8cfc4a0de645fad13fe517b52c9fa2" have entirely different histories.
9042e78ae8
...
17882bb82c
|
|
@ -1055,11 +1055,8 @@
|
||||||
|
|
||||||
;; Serve regular static file
|
;; Serve regular static file
|
||||||
(t
|
(t
|
||||||
(let ((file-path (merge-pathnames (format nil "static/~a" path)
|
(serve-file (merge-pathnames (format nil "static/~a" path)
|
||||||
(asdf:system-source-directory :asteroid))))
|
(asdf:system-source-directory :asteroid))))))
|
||||||
(if (probe-file file-path)
|
|
||||||
(serve-file file-path)
|
|
||||||
(error 'radiance:request-not-found))))))
|
|
||||||
|
|
||||||
;; Status check functions
|
;; Status check functions
|
||||||
(defun check-stream-status ()
|
(defun check-stream-status ()
|
||||||
|
|
@ -1494,30 +1491,14 @@
|
||||||
;; RADIANCE server management functions
|
;; RADIANCE server management functions
|
||||||
|
|
||||||
(defun start-server (&key (port *server-port*))
|
(defun start-server (&key (port *server-port*))
|
||||||
"Start the Asteroid Radio RADIANCE server.
|
"Start the Asteroid Radio RADIANCE server"
|
||||||
Reads ASTEROID_DEBUG from the environment to control Radiance's debugger policy:
|
|
||||||
nil (or unset) - never invoke debugger (production default)
|
|
||||||
if-swank-connected - invoke only when Swank/Slynk is connected
|
|
||||||
t - always invoke debugger"
|
|
||||||
(format t "Starting Asteroid Radio RADIANCE server on port ~a~%" port)
|
(format t "Starting Asteroid Radio RADIANCE server on port ~a~%" port)
|
||||||
(compile-styles) ; Generate CSS file using LASS
|
(compile-styles) ; Generate CSS file using LASS
|
||||||
|
|
||||||
;; Set debugger policy from environment to prevent stray conditions from
|
;; Ensure RADIANCE environment is properly set before startup
|
||||||
;; accumulating debugger sessions (e.g. vulnerability scanners hitting bogus paths)
|
;; (unless (radiance:environment)
|
||||||
(let ((debug-env (uiop:getenv "ASTEROID_DEBUG")))
|
;; (setf (radiance:environment) "asteroid"))
|
||||||
(setf radiance:*debugger*
|
|
||||||
(cond
|
|
||||||
((or (null debug-env)
|
|
||||||
(string-equal debug-env "nil")
|
|
||||||
(string-equal debug-env ""))
|
|
||||||
nil)
|
|
||||||
((string-equal debug-env "t")
|
|
||||||
t)
|
|
||||||
((string-equal debug-env "if-swank-connected")
|
|
||||||
:if-swank-connected)
|
|
||||||
(t nil)))
|
|
||||||
(format t "Debugger policy: ~a~%" radiance:*debugger*))
|
|
||||||
|
|
||||||
(radiance:startup)
|
(radiance:startup)
|
||||||
|
|
||||||
;; Start listener statistics polling
|
;; Start listener statistics polling
|
||||||
|
|
|
||||||
|
|
@ -202,27 +202,3 @@
|
||||||
(error 'authorization-error
|
(error 'authorization-error
|
||||||
:message message
|
:message message
|
||||||
:required-role required-role))
|
:required-role required-role))
|
||||||
|
|
||||||
;;; Override Radiance's default render-error-page to return proper HTTP
|
|
||||||
;;; status codes instead of a blanket 500 for conditions like
|
|
||||||
;;; request-not-found and file-to-serve-does-not-exist. This prevents
|
|
||||||
;;; vulnerability scanners from generating misleading 500 responses and
|
|
||||||
;;; gives us control over error presentation.
|
|
||||||
(defun radiance:render-error-page (condition)
|
|
||||||
(cond
|
|
||||||
((typep condition 'radiance:request-not-found)
|
|
||||||
(setf (radiance:return-code radiance:*response*) 404)
|
|
||||||
(setf (radiance:content-type radiance:*response*) "text/plain")
|
|
||||||
"Not Found")
|
|
||||||
((typep condition 'radiance:file-to-serve-does-not-exist)
|
|
||||||
(setf (radiance:return-code radiance:*response*) 404)
|
|
||||||
(setf (radiance:content-type radiance:*response*) "text/plain")
|
|
||||||
"Not Found")
|
|
||||||
((typep condition 'radiance:request-denied)
|
|
||||||
(setf (radiance:return-code radiance:*response*) 403)
|
|
||||||
(setf (radiance:content-type radiance:*response*) "text/plain")
|
|
||||||
"Forbidden")
|
|
||||||
(t
|
|
||||||
(setf (radiance:return-code radiance:*response*) 500)
|
|
||||||
(setf (radiance:content-type radiance:*response*) "text/plain")
|
|
||||||
"Internal Server Error")))
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue