get docker deploy working
This commit is contained in:
parent
7e0659cebe
commit
637bb6740c
10 changed files with 101 additions and 23 deletions
|
|
@ -3,8 +3,7 @@
|
|||
[clj-http.client :as http-client]
|
||||
[micro-blog.pocket-base :as pb]
|
||||
[micro-blog.utils :as utils]
|
||||
[malli.core :as m]
|
||||
[clojure.pprint :refer [pprint]]
|
||||
[taoensso.telemere :as tel]
|
||||
[micro-blog.config :refer [config]]))
|
||||
|
||||
(defn create-session []
|
||||
|
|
@ -97,6 +96,7 @@
|
|||
(map #(vector (:fullsize %) (:alt %)) images)))
|
||||
|
||||
(defn run []
|
||||
(tel/log! :info "Running blue sky fetcher")
|
||||
(let [session (create-session)
|
||||
last-saved-id (pb/get-latest-post-remote-id-by-source :blue_sky)
|
||||
new-posts (reverse (get-posts-until-id session last-saved-id))]
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
(ns micro-blog.config
|
||||
(:require [environ.core :refer [env]]))
|
||||
(:require
|
||||
[taoensso.telemere :as tel]))
|
||||
|
||||
(def ^:private env-overrides
|
||||
{:minstral-api-key "MISTRAL_API_KEY"})
|
||||
{:pocket-base-pw "POCKET_BASE_PW"
|
||||
:pocket-base-host "POCKET_BASE_HOST"
|
||||
:blue-sky-api-key "BLUE_SKY_API_KEY"
|
||||
:minstral-api-key "MISTRAL_API_KEY"})
|
||||
|
||||
(defn- load-config []
|
||||
(println "config is being loaded")
|
||||
(tel/log! :info "Config is being loaded")
|
||||
(merge (read-string (slurp "config.edn"))
|
||||
(into {} (for [[k env-var] env-overrides
|
||||
:let [env-val (env env-var)]
|
||||
:let [env-val (System/getenv env-var)]
|
||||
:when env-val]
|
||||
[k env-val]))))
|
||||
|
||||
|
|
|
|||
14
src/micro_blog/main.clj
Normal file
14
src/micro_blog/main.clj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(ns micro-blog.main
|
||||
(:gen-class)
|
||||
(:import [java.time Instant Duration])
|
||||
(:require [chime.core :as chime]
|
||||
[taoensso.telemere :as tel]
|
||||
[micro-blog.blue-sky :as blue-sky]))
|
||||
|
||||
(defn -main []
|
||||
(tel/log! :info "Setting up crons")
|
||||
(chime/chime-at (chime/periodic-seq (Instant/now) (Duration/ofMinutes 30))
|
||||
(fn [_time]
|
||||
(blue-sky/run)))
|
||||
|
||||
@(promise))
|
||||
Loading…
Add table
Add a link
Reference in a new issue