Commit 6fc39f9 1 parent 53057fa commit 6fc39f9 Copy full SHA for 6fc39f9
File tree 4 files changed +27
-2
lines changed
4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
+ echo " Creating properties file..."
3
+ echo
4
+ if [ " $GITHUB_TOKEN " = " " ]; then
5
+ echo " You must specify a Github token using the env variable \$ GITHUB_TOKEN.
6
+ If you don't have a token, generate one at https://github.com/settings/tokens"
7
+ exit -1
8
+ fi
9
+ if [ " $SLACK_WEBHOOK_URL " = " " ]; then
10
+ echo " You must specify a Slack webhook URL using the env variable \$ SLACK_WEBHOOK_URL.
11
+ If you don't have one yet, generate it at https://slack.com/apps/new/A0F7XDUAZ-incoming-webhooks"
12
+ exit -1
13
+ fi
14
+
15
+ # create a config file with the token and url
16
+ echo " github.token=$GITHUB_TOKEN " > resources/config.properties
17
+ echo " slack.webhook.url=$SLACK_WEBHOOK_URL " >> resources/config.properties
18
+
2
19
echo " Creating uberjar:"
20
+ echo
3
21
4
22
lein uberjar
5
23
cp $PWD /target/uberjar/tako-* -standalone.jar $PWD /target/tako.jar
Original file line number Diff line number Diff line change 7
7
[cheshire " 5.5.0" ]
8
8
[org.julienxx/clj-slack " 0.5.2.1" ]
9
9
[org.clojure/tools.logging " 0.3.1" ]
10
+ [clojurewerkz/propertied " 1.2.0" ]
10
11
[com.amazonaws/aws-lambda-java-core " 1.1.0" ]]
11
12
:main ^:skip-aot tako.core
12
13
:target-path " target/%s"
Original file line number Diff line number Diff line change
1
+ github.token =set when running ./lambda-deploy
2
+ slack.webhook.url =set when running ./lambda-deploy
Original file line number Diff line number Diff line change 1
1
(ns tako.core
2
2
(:require [tako.github :as github]
3
3
[tako.slack :as slack]
4
+ [clojure.java.io :as io]
5
+ [clojurewerkz.propertied.properties :as props]
4
6
[clojure.tools.logging :refer [info]])
5
7
(:gen-class
6
8
:methods [^:static [handler [Object] String]]))
7
9
8
- (def github-token " PLACE YOUR GITHUB TOKEN HERE" )
9
- (def slack-webhook-url " PLACE THE SLACK WEBHOOK URL HERE" )
10
+ ; ; read credentials from config file
11
+ (def config (-> " config.properties" io/resource props/load-from props/properties->map))
12
+ (def github-token (config " github.token" ))
13
+ (def slack-webhook-url (config " slack.webhook.url" ))
10
14
11
15
(defn -handler
12
16
" This is the function called by AWS Lambda"
You can’t perform that action at this time.
0 commit comments