;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.wiki) ;;;;;; ;;; Constants (def (constant e) +default-database-name+ "hu.dwim.wiki") (def (constant e) +default-database-user-name+ "hu.dwim.wiki") (def (constant e) +default-database-password+ "engedjbe") ;;;;;; ;;; Application (def (class* e) wiki-application (application-with-persistent-login-support application-with-perec-support application-with-home-package application-with-dojo-support) ()) (def (special-variable e) *wiki-application* (make-instance 'wiki-application)) (def method authorize-operation ((application wiki-application) form) (wiki-authorization form)) (def method iterate-possible-authentication-instruments ((application wiki-application) identifier visitor) (bind ((users (select-similar-instances wiki-user :user-name identifier))) (dolist (user users) (foreach visitor (authentication-instruments-of user))))) ;;;;;; ;;; Entry points (def file-serving-entry-point *wiki-application* "static/wiki/" (system-relative-pathname :hu.dwim.wiki "www/")) (def entry-point (*wiki-application* :path "") (with-entry-point-logic (:ensure-session #t :ensure-frame #t) (make-frame-root-component-rendering-response))) ;;;;;; ;;; Server (def (special-variable e) *wiki-server* (make-instance 'broker-based-server :host +any-host+ :port +default-http-server-port+ :brokers (list* *wiki-application* (make-default-broker-list)))) (def localization-loader-callback wiki-localization-loader :hu.dwim.wiki "localization/") ;;;;;; ;;; Production (def function executable-toplevel () "The toplevel function that is called when the dwim Server is started from the command line. For development use (asdf:develop-system :hu.dwim.wiki) instead." (with-standard-toplevel-restarts (bind ((options (append (list +help-command-line-option+) (list +quiet-command-line-option+) (copy-command-line-options +database-command-line-options+ :database-port hu.dwim.rdbms.postgresql:+default-postgresql-database-server-port+ :database-name +default-database-name+ :database-user-name +default-database-user-name+ :database-password +default-database-password+) +generic-command-line-options+)) (arguments (parse-command-line-arguments options))) (process-help-command-line-argument options arguments) (process-quiet-command-line-argument arguments) (wiki.debug "Parsed command line arguments are: ~S" arguments) (run-production-server arguments :hu.dwim.wiki *wiki-server* *wiki-application*) +process-return-code/no-error+)))