Skip to content

Commit c0789ba

Browse files
committed
Add slack invite form
1 parent 92f0de0 commit c0789ba

File tree

4 files changed

+87
-31
lines changed

4 files changed

+87
-31
lines changed
Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
61313238636666353031616265616533666263613030613261623865386636393664323631366139
3-
6461383234653263656461373164396237313432323866320a653533653164323064613633613234
4-
37373161626138343437333462306463313265633161346665653430373765663632656166373237
5-
6430626430303336340a383231316365633836623661636534303338303338653339353762643934
6-
37376331323864616164643262366334656538643331633935353866616236626165343337323032
7-
33366166383261623039613338373237336332623532616632363363636437383737343461633066
8-
62333733666265643866373130666265656138393163383838633861343766323137616662646631
9-
35386363666430306130323835376534623462613739366431613638653036623361653461303965
10-
63303334373235323931306336316631393830663937393832356437343430616466643664323565
11-
32663638646365303866326161643336633939316237353961303132376665613666396332613938
12-
61346238383366633463623362626637333533323239616663343663633064386536376362666638
13-
62356661623461363834643031376131626536353139353439353734346365343035356463306565
14-
65626465313738626562393866343761636638343066316437373737333136366639316333656431
15-
63383332323137356463303262646533383735636631353065646131323834656237336137386235
16-
31323438656164646531346333613538663061393266323630393530386233336236353731656238
17-
38616535363333336439336531353064623564323464316130633362353131313961613938633339
18-
34363437343766313661636239346165323831333732323232363466663231626236613132373266
19-
32373531323431316534663564353537663061333835336662626463616163303433303833306437
20-
64353337643731343839376566356639333630646164393939653165303636616662393236363362
21-
35643138316661656430646138353630643332653936323861646634663435393638623864623261
22-
64323536303263663361303663376662356634653066376635336464376133356633333632666164
23-
31613561346262343731366133643339613833386133626638613534313265393038313736643964
24-
33613339656562383330306138643634363462633632613331636232633762373134653736353863
25-
65316239333836643734623831396537383563306165616362326231613539626130623762613832
26-
64373834303266366339653738343738346431623562393233323434383931323036373065323434
27-
31653632383535383435393664323833383263613735353365633264396163333334376533393933
28-
37363336643765303936653530383738646662326332643765613365386433383366636331373361
29-
64303432323061646464623539643061363364393338643465613431356461623532623031306633
30-
35333233333734643666386565333831373239356261623465393163663933376637626436393166
31-
61303436306262386365346530333531626635323534633634376665313165396538643632396264
32-
653335353635343964336661643131393839
2+
38386561623162363034336566633562353737656165363639613839326662653566353865313330
3+
6636316632636435313062343938666130393536656362660a613630656262393461326362626235
4+
37616665653334613131653362393530363630613664363936363865643639363532343434623964
5+
6165306239376161360a643862376535333561636539663266613438383664636335336230613139
6+
30386566376138333832333036323865646162303264616231363735633065656565383836623433
7+
35386131623364373861653038626138666134383265393239343363333937356230306561313262
8+
63656464353763363862646364666531633433356463653339373033393262323736396535343162
9+
65363064383335373232376637393836353061313537396431386465366238343133613438333239
10+
66613738383534393664303062373030303662373463303063336630393163616662313431306361
11+
33663662396664313831303331326330633762376561313338313562656261663565333035353933
12+
66373934653331636261653830336539393765646262623663633337316662336266636539396164
13+
34663033666136343364663663393165336131343337386635316339336563613032393662373039
14+
66323933303662323938333337353663336332656164663261316532336639356531373036373338
15+
37393561306165396461343230663332366435333338366535386337366264643237326161616361
16+
34633031623963356239323332656663343564613963623061333463373861386233343233306161
17+
34396263623737666464363734326565306331616433346361393632643061303762356161623136
18+
35383361363937636261646337313735616162376437646631376237623031303662633536396536
19+
39653162326162393635363663656230373237353232353130386363363866613566643838306362
20+
30336532646331616539613162613433353237386437353762333130636433333233366163353333
21+
65323632313063333534646566336138653364373036653363393539643933646430333263373963
22+
36613537356562386263333831353630353265323439326562373964626262316631353839383531
23+
61303466646461623734396664323630653331383766323830653938323737386566613637373366
24+
64663131366131383831346136376131636262663735613336613135366566633231316565663963
25+
65343536613465336361303134613763613266646136323239326363386666656430366136376538
26+
61366666623563346538633839646133373634626236613265613737313863346235663137393766
27+
37646638323133653536656336653536633438303536636333316461633163343863633139366335
28+
35376564353631353938313135343962306262653263363963376236306364316436333439303864
29+
62666534383233663838616430613964306439613338383130396632326331653734303630303231
30+
63386131646334666266393133383639303738636663393630383637376530363737326135386133
31+
66373938633531356338303334623262626639313030386161326366643733626262326663333738
32+
32316165303163633666326239613730653638356330663438353863353439346661356666666230
33+
36636163343533306330343239643330623132326437633231306432316135653936353865323532
34+
35393530316130636464646235313963636162623463313731393433636133363337306532373362
35+
64303936393332393836383538656564633834353637383338386338336363393661616466663461
36+
62373864323035336533396135653735383838303639373731623564386663303135336464653631
37+
63346534333331376564323563643634383135316361383166386633346462643661646336303265
38+
6538

ansible/inventories/production/group_vars/stubbornjava/webserver_vars.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
host: "{{_vault.metrics.graphite.host}}"
1414
grafana:
1515
api_key: "{{_vault.metrics.grafana.api_key}}"
16+
17+
slack:
18+
legacyToken: "{{_vault.slack.legacyToken}}"

ansible/roles/apps/jvm_app_base/templates/secure.conf.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ metrics {
1313
graphite.host="{{metrics.graphite.host}}"
1414
grafana.api_key="{{metrics.grafana.api_key}}"
1515
}
16+
17+
slack {
18+
legacyToken="{{slack.legacyToken}}"
19+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.stubbornjava.webapp.integrations;
2+
3+
import java.io.IOException;
4+
5+
import org.jooq.lambda.Unchecked;
6+
7+
import com.stubbornjava.common.Configs;
8+
import com.stubbornjava.common.HttpClient;
9+
import com.stubbornjava.webapp.StubbornJavaBootstrap;
10+
11+
import okhttp3.FormBody;
12+
import okhttp3.HttpUrl;
13+
import okhttp3.OkHttpClient;
14+
import okhttp3.Request;
15+
import okhttp3.Response;
16+
17+
public class Slack {
18+
private static final String legacyToken = Configs.properties().getString("slack.legacyToken");
19+
private static final OkHttpClient client = HttpClient.globalClient();
20+
21+
public static boolean invite(String email) {
22+
HttpUrl url = HttpUrl.parse("https://slack.com/api/users.admin.invite");
23+
FormBody body = new FormBody.Builder()
24+
.add("token", legacyToken)
25+
.add("email", email)
26+
.add("resend", "true")
27+
.build();
28+
Request request = new Request.Builder().url(url).post(body).build();
29+
try (Response response = client.newCall(request).execute()) {
30+
return response.isSuccessful();
31+
} catch (IOException ex) {
32+
Unchecked.throwChecked(ex);
33+
return false;
34+
}
35+
}
36+
37+
public static void main(String[] args) {
38+
StubbornJavaBootstrap.run(() -> {
39+
System.out.println(legacyToken);
40+
});
41+
42+
}
43+
}

0 commit comments

Comments
 (0)