nginx fix

This commit is contained in:
Daniel Ziltener 2019-12-09 16:53:02 +01:00
parent 8c776921ee
commit d4b37360dc
1 changed files with 8 additions and 3 deletions

View File

@ -19,6 +19,8 @@
;; # Webserver configuration ;; # Webserver configuration
;; ## Deployment directory structure
(defn- set-owner [path owner] (defn- set-owner [path owner]
(-> (->
(Files/getFileAttributeView path PosixFileAttributeView (into-array LinkOption [LinkOption/NOFOLLOW_LINKS])) (Files/getFileAttributeView path PosixFileAttributeView (into-array LinkOption [LinkOption/NOFOLLOW_LINKS]))
@ -67,15 +69,16 @@
;; (set-group link group) ;; (set-group link group)
))) )))
;; ## nginx configuration
(defn create-nginx-server! [datamap] (defn create-nginx-server! [datamap]
(doseq [file ["skel.talent.careers" (doseq [file ["skel.talent.careers"
"staging.skel.talent.careers"] "staging.skel.talent.careers"]
:let [in-file (str "resources/nginx/" file) :let [in-file (str "resources/nginx/" file)
out-file (format "/etc/nginx/servers-available/%s" (str/replace file #"skel" (:company-name datamap)))]] out-file (format "/etc/nginx/servers-available/%s" (str/replace file #"skel" (:company-name datamap)))]]
(info "using template" in-file "to create" out-file) (info "using template" in-file "to create" out-file)
(-> (slurp in-file) (spit out-file
(cljstache/render datamap) (cljstache/render (slurp in-file) datamap))))
(spit out-file))))
;; # DNS configuration ;; # DNS configuration
@ -101,6 +104,8 @@
:content-type :json :content-type :json
:form-params entry}))))) :form-params entry})))))
;; # Main initialization
(defn -main [& args] (defn -main [& args]
(let [datamap {:company-name (nth args 0) (let [datamap {:company-name (nth args 0)
:company-suffix (nth args 1)}] :company-suffix (nth args 1)}]