Use aero for config and make first deployable version
This commit is contained in:
parent
321a4c4f57
commit
663ddfbce2
8 changed files with 28 additions and 10 deletions
|
|
@ -4,3 +4,4 @@ node_modules
|
||||||
resources/public/js
|
resources/public/js
|
||||||
.git
|
.git
|
||||||
target
|
target
|
||||||
|
pom.xml
|
||||||
|
|
|
||||||
12
README.md
Normal file
12
README.md
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# All my Friends
|
||||||
|
|
||||||
|
This is scratching a weird itch that started when I saw my friends mostly online.
|
||||||
|
|
||||||
|
## Important paths
|
||||||
|
|
||||||
|
* `src/heyarne/all_my_friends/server.clj`: Contains a simple HTTP server that serves static files and has a handler for uploads
|
||||||
|
* `src/heyarne/all_my_friends/client.cljs`: Is the starting point for the client application
|
||||||
|
* `resources/config.edn`: Uses [aero](https://github.com/juxt/aero/tree/1ecae6465405643aaacd54b9b45b4fdb92d1cf7a) for configuration.
|
||||||
|
* `resources/public`: Contains HTML and CSS files. `resources/public/js` is automatically compiled.
|
||||||
|
* `deps.edn`: Client and server dependencies and build configuration
|
||||||
|
* `shadow-cljs.edn`: Client-side build config for [shadow-cljs](https://shadow-cljs.github.io/docs/UsersGuide.html)
|
||||||
2
deps.edn
2
deps.edn
|
|
@ -1,6 +1,6 @@
|
||||||
{:paths ["src" "resources"]
|
{:paths ["src" "resources"]
|
||||||
:deps {org.clojure/clojure {:mvn/version "1.10.1"}
|
:deps {org.clojure/clojure {:mvn/version "1.10.1"}
|
||||||
environ {:mvn/version "1.1.0"}
|
aero {:mvn/version "1.1.6"}
|
||||||
http-kit {:mvn/version "2.3.0"}
|
http-kit {:mvn/version "2.3.0"}
|
||||||
compojure {:mvn/version "1.6.1"}
|
compojure {:mvn/version "1.6.1"}
|
||||||
ring-logger {:mvn/version "1.0.1"}}
|
ring-logger {:mvn/version "1.0.1"}}
|
||||||
|
|
|
||||||
1
resources/config.edn
Normal file
1
resources/config.edn
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{:port #long #or [#env PORT 8081]}
|
||||||
|
|
@ -6,4 +6,4 @@
|
||||||
{:app {:target :browser
|
{:app {:target :browser
|
||||||
:output-dir "resources/public/js"
|
:output-dir "resources/public/js"
|
||||||
:asset-path "/js"
|
:asset-path "/js"
|
||||||
:modules {:main {:entries [heyarne.all-my-friends.core]}}}}}
|
:modules {:main {:entries [heyarne.all-my-friends.client]}}}}}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
(ns heyarne.all-my-friends.core
|
(ns heyarne.all-my-friends.client
|
||||||
(:require [applied-science.js-interop :as j]
|
(:require [applied-science.js-interop :as j]
|
||||||
[reagent.dom :as dom]
|
[reagent.dom :as dom]
|
||||||
[heyarne.all-my-friends.views :as views]))
|
[heyarne.all-my-friends.views :as views]))
|
||||||
5
src/heyarne/all_my_friends/env.cljc
Normal file
5
src/heyarne/all_my_friends/env.cljc
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
(ns heyarne.all-my-friends.env
|
||||||
|
[:require [aero.core :refer [read-config]]
|
||||||
|
[clojure.java.io :as io]])
|
||||||
|
|
||||||
|
(def env (read-config (io/resource "config.edn")))
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
[compojure.core :as router]
|
[compojure.core :as router]
|
||||||
[compojure.route :as route]
|
[compojure.route :as route]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
[environ.core :refer [env]]
|
[ring.logger :as logger]
|
||||||
[ring.logger :as logger])
|
[heyarne.all-my-friends.env :refer [env]])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
|
||||||
(router/defroutes app
|
(router/defroutes app
|
||||||
|
|
@ -26,11 +26,10 @@
|
||||||
|
|
||||||
|
|
||||||
(defn -main [& args]
|
(defn -main [& args]
|
||||||
(let [port (Integer/parseInt (env :port "8081"))]
|
(println "Starting server on port" (env :port))
|
||||||
(println "Starting server on port" port)
|
(reset! server (-> #'app
|
||||||
(reset! server (-> #'app
|
(logger/wrap-with-logger
|
||||||
(logger/wrap-with-logger)
|
(http/run-server {:port (env :port)})))))
|
||||||
(http/run-server {:port port})))))
|
|
||||||
|
|
||||||
#_(-main)
|
#_(-main)
|
||||||
#_(stop-server)
|
#_(stop-server)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue