auth: config with admin credentials
This commit is contained in:
parent
b062ec2962
commit
0cd12b377b
3 changed files with 20 additions and 9 deletions
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
(defpackage :scopes-auth
|
(defpackage :scopes-auth
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:dom :scopes/web/dom)
|
(:local-nicknames (:config :scopes/config)
|
||||||
(:util :scopes/util))
|
(:util :scopes/util))
|
||||||
(:import-from :scopes/web/dom #:div #:label)
|
(:import-from :scopes/web/dom #:div #:label)
|
||||||
(:export #:login))
|
(:export #:config
|
||||||
|
#:login))
|
||||||
|
|
||||||
(in-package :scopes-auth)
|
(in-package :scopes-auth)
|
||||||
|
|
||||||
|
(defclass config (config:base)
|
||||||
|
((admin-credentials :initarg :admin-credentials)))
|
||||||
|
|
||||||
(defun login (cred)
|
(defun login (cred)
|
||||||
(util:lgi cred))
|
(util:lgi cred))
|
||||||
|
|
4
lib/auth/test/.test.env
Normal file
4
lib/auth/test/.test.env
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# lib/auth/test/.test.env - environment file for overriding config settings
|
||||||
|
|
||||||
|
SCOPES_ADMIN_LOGIN=admin
|
||||||
|
SCOPES_ADMIN_PASSWORD=sc0pes
|
|
@ -5,17 +5,21 @@
|
||||||
|
|
||||||
(in-package :scopes-auth/test)
|
(in-package :scopes-auth/test)
|
||||||
|
|
||||||
(config:root :env-keys
|
(config:root
|
||||||
'(:address :port
|
:env-keys '(:address :port :db-name :db-user :db-password
|
||||||
:db-name :db-user :db-password))
|
:admin-login :admin-password)
|
||||||
|
:env-path (t:test-path ".test.env"))
|
||||||
|
|
||||||
(config:add :logger :class 'logging:config
|
(config:add :logger :class 'logging:config
|
||||||
:loglevel :info
|
:loglevel :info
|
||||||
:logfile (t:test-path "scopes-test.log" "log")
|
:logfile (t:test-path "scopes-test.log" "log")
|
||||||
:console nil)
|
:console nil)
|
||||||
|
|
||||||
(config:add :server
|
(config:add :auth :class 'auth:config
|
||||||
:class 'server:config
|
:admin-credentials `(:login ,(config:from-env :admin-login "admin")
|
||||||
|
:password ,(config:from-env :admin-password "secret")))
|
||||||
|
|
||||||
|
(config:add :server :class 'server:config
|
||||||
:port "8899"
|
:port "8899"
|
||||||
:routes
|
:routes
|
||||||
`((("hx") server:message-handler :html-responder cs-hx:response)
|
`((("hx") server:message-handler :html-responder cs-hx:response)
|
||||||
|
@ -23,7 +27,6 @@
|
||||||
:doc-root ,(t:test-path "" "docs"))))
|
:doc-root ,(t:test-path "" "docs"))))
|
||||||
(config:add-action '(:auth :login) #'auth:login)
|
(config:add-action '(:auth :login) #'auth:login)
|
||||||
|
|
||||||
(config:add :client
|
(config:add :client :class 'client:config
|
||||||
:class 'client:config
|
|
||||||
:base-url "http://localhost:8899"
|
:base-url "http://localhost:8899"
|
||||||
:doc-path "/" :api-path "/hx/")
|
:doc-path "/" :api-path "/hx/")
|
||||||
|
|
Loading…
Add table
Reference in a new issue