Skip to content

Add slack invite form #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
$ANSIBLE_VAULT;1.1;AES256
61313238636666353031616265616533666263613030613261623865386636393664323631366139
6461383234653263656461373164396237313432323866320a653533653164323064613633613234
37373161626138343437333462306463313265633161346665653430373765663632656166373237
6430626430303336340a383231316365633836623661636534303338303338653339353762643934
37376331323864616164643262366334656538643331633935353866616236626165343337323032
33366166383261623039613338373237336332623532616632363363636437383737343461633066
62333733666265643866373130666265656138393163383838633861343766323137616662646631
35386363666430306130323835376534623462613739366431613638653036623361653461303965
63303334373235323931306336316631393830663937393832356437343430616466643664323565
32663638646365303866326161643336633939316237353961303132376665613666396332613938
61346238383366633463623362626637333533323239616663343663633064386536376362666638
62356661623461363834643031376131626536353139353439353734346365343035356463306565
65626465313738626562393866343761636638343066316437373737333136366639316333656431
63383332323137356463303262646533383735636631353065646131323834656237336137386235
31323438656164646531346333613538663061393266323630393530386233336236353731656238
38616535363333336439336531353064623564323464316130633362353131313961613938633339
34363437343766313661636239346165323831333732323232363466663231626236613132373266
32373531323431316534663564353537663061333835336662626463616163303433303833306437
64353337643731343839376566356639333630646164393939653165303636616662393236363362
35643138316661656430646138353630643332653936323861646634663435393638623864623261
64323536303263663361303663376662356634653066376635336464376133356633333632666164
31613561346262343731366133643339613833386133626638613534313265393038313736643964
33613339656562383330306138643634363462633632613331636232633762373134653736353863
65316239333836643734623831396537383563306165616362326231613539626130623762613832
64373834303266366339653738343738346431623562393233323434383931323036373065323434
31653632383535383435393664323833383263613735353365633264396163333334376533393933
37363336643765303936653530383738646662326332643765613365386433383366636331373361
64303432323061646464623539643061363364393338643465613431356461623532623031306633
35333233333734643666386565333831373239356261623465393163663933376637626436393166
61303436306262386365346530333531626635323534633634376665313165396538643632396264
653335353635343964336661643131393839
38386561623162363034336566633562353737656165363639613839326662653566353865313330
6636316632636435313062343938666130393536656362660a613630656262393461326362626235
37616665653334613131653362393530363630613664363936363865643639363532343434623964
6165306239376161360a643862376535333561636539663266613438383664636335336230613139
30386566376138333832333036323865646162303264616231363735633065656565383836623433
35386131623364373861653038626138666134383265393239343363333937356230306561313262
63656464353763363862646364666531633433356463653339373033393262323736396535343162
65363064383335373232376637393836353061313537396431386465366238343133613438333239
66613738383534393664303062373030303662373463303063336630393163616662313431306361
33663662396664313831303331326330633762376561313338313562656261663565333035353933
66373934653331636261653830336539393765646262623663633337316662336266636539396164
34663033666136343364663663393165336131343337386635316339336563613032393662373039
66323933303662323938333337353663336332656164663261316532336639356531373036373338
37393561306165396461343230663332366435333338366535386337366264643237326161616361
34633031623963356239323332656663343564613963623061333463373861386233343233306161
34396263623737666464363734326565306331616433346361393632643061303762356161623136
35383361363937636261646337313735616162376437646631376237623031303662633536396536
39653162326162393635363663656230373237353232353130386363363866613566643838306362
30336532646331616539613162613433353237386437353762333130636433333233366163353333
65323632313063333534646566336138653364373036653363393539643933646430333263373963
36613537356562386263333831353630353265323439326562373964626262316631353839383531
61303466646461623734396664323630653331383766323830653938323737386566613637373366
64663131366131383831346136376131636262663735613336613135366566633231316565663963
65343536613465336361303134613763613266646136323239326363386666656430366136376538
61366666623563346538633839646133373634626236613265613737313863346235663137393766
37646638323133653536656336653536633438303536636333316461633163343863633139366335
35376564353631353938313135343962306262653263363963376236306364316436333439303864
62666534383233663838616430613964306439613338383130396632326331653734303630303231
63386131646334666266393133383639303738636663393630383637376530363737326135386133
66373938633531356338303334623262626639313030386161326366643733626262326663333738
32316165303163633666326239613730653638356330663438353863353439346661356666666230
36636163343533306330343239643330623132326437633231306432316135653936353865323532
35393530316130636464646235313963636162623463313731393433636133363337306532373362
64303936393332393836383538656564633834353637383338386338336363393661616466663461
62373864323035336533396135653735383838303639373731623564386663303135336464653631
63346534333331376564323563643634383135316361383166386633346462643661646336303265
6538
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
host: "{{_vault.metrics.graphite.host}}"
grafana:
api_key: "{{_vault.metrics.grafana.api_key}}"

slack:
legacyToken: "{{_vault.slack.legacyToken}}"
4 changes: 4 additions & 0 deletions ansible/roles/apps/jvm_app_base/templates/secure.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ metrics {
graphite.host="{{metrics.graphite.host}}"
grafana.api_key="{{metrics.grafana.api_key}}"
}

slack {
legacyToken="{{slack.legacyToken}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.stubbornjava.webapp.integrations;

import java.io.IOException;

import org.jooq.lambda.Unchecked;

import com.stubbornjava.common.Configs;
import com.stubbornjava.common.HttpClient;
import com.stubbornjava.webapp.StubbornJavaBootstrap;

import okhttp3.FormBody;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class Slack {
private static final String legacyToken = Configs.properties().getString("slack.legacyToken");
private static final OkHttpClient client = HttpClient.globalClient();

public static boolean invite(String email) {
HttpUrl url = HttpUrl.parse("https://slack.com/api/users.admin.invite");
FormBody body = new FormBody.Builder()
.add("token", legacyToken)
.add("email", email)
.add("resend", "true")
.build();
Request request = new Request.Builder().url(/api/flow.js?q=https%3A%2F%2Fgithub.com%2FStubbornJava%2FStubbornJava%2Fpull%2F102%2Furl).post(body).build();
try (Response response = client.newCall(request).execute()) {
return response.isSuccessful();
} catch (IOException ex) {
Unchecked.throwChecked(ex);
return false;
}
}

public static void main(String[] args) {
StubbornJavaBootstrap.run(() -> {
System.out.println(legacyToken);
});

}
}