4 if (which xdg-open
>/dev
/null
); then
12 if (which sha256sum
>/dev
/null
); then
19 function generate_password
{
20 if (which openssl
>/dev
/null
); then
23 (hostname
; date +%s
; ls -la /) |
rev |
hash | base64 |
head -c 32
27 if [[ -f .env
]]; then
34 if [[ -z "${gitlaboauth__client_id}${gitlaboauth__client_secret}" ]]; then
36 echo "You need to create a GitLab Application to connect with GitLab"
37 echo "Application Name: Gitter User Dev"
38 echo "Redirect URI: http://localhost:5000/login/gitlab/callback"
39 echo "Select the \"api\" and \"read_user\" scope"
41 echo "Press ENTER to open GitLab"
43 browse_to https
://gitlab.com
/profile
/applications
45 echo "Paste the Application ID below and press ENTER"
46 read gitlaboauth__client_id
47 echo "Paste the Secret below and press ENTER"
48 read gitlaboauth__client_secret
52 if [[ -z "${github__user_client_id}${github__user_client_secret}" ]]; then
54 echo "You need to create a GitHub Application to connect with GitHub"
55 echo "Application Name: Gitter User Dev"
56 echo "Homepage URL: http://localhost:5000"
57 echo "Authorisation callback URL: http://localhost:5000/login/callback"
59 echo "Press ENTER to open GitHub"
61 browse_to https
://github.com
/settings
/applications
/new
63 echo "Paste the Client ID below and press ENTER"
64 read github__user_client_id
65 echo "Paste the Client Secret below and press ENTER"
66 read github__user_client_secret
70 if [[ -z "${github__client_id}${github__client_secret}" ]]; then
72 echo "You need to do this again to create a scoped token for Private Repository access"
73 echo "Application Name: Gitter Private Dev"
74 echo "Homepage URL: http://localhost:5000"
75 echo "Authorisation callback URL: http://localhost:5000/login/callback"
77 echo "Press ENTER to open GitHub"
79 browse_to https
://github.com
/settings
/applications
/new
81 echo "Paste the Client ID below and press ENTER"
82 read github__client_id
83 echo "Paste the Client Secret below and press ENTER"
84 read github__client_secret
88 if [[ -z "${twitteroauth__consumer_key}${twitteroauth__consumer_secret}" ]]; then
90 echo "We also connect with Twitter, so, yeah, you need to create a Twitter App too."
91 echo "Name: Gitter Twitter YOURTWITTERUSERNAME"
92 echo "Description: Connect Gitter with Twitter"
93 echo "Website: http://test.gitter.im"
94 echo "Callback URL: http://localhost:5000/login/twitter/callback"
96 echo "Press ENTER to open Twitter"
98 browse_to https
://developer.twitter.com
/en
/apps
/create
99 echo "Click 'keys and tokens' to get your Consumer API Keys"
100 echo "Paste the Consumer API Key below and press ENTER"
101 read twitteroauth__consumer_key
102 echo "Paste the Consumer API Secret Key below and press ENTER"
103 read twitteroauth__consumer_secret
107 if [[ -f .env
]]; then
108 cp .env .env.backup.$
(date +%s
)
112 export web__sessionSecret="$(generate_password)"
113 export ws__superClientPassword="$(generate_password)"
114 export web__messageSecret="$(generate_password)"
115 export email__unsubscribeNotificationsSecret="$(generate_password)"
116 export integrations__secret="$(generate_password)"
117 export github__statePassphrase="$(generate_password)"
118 export twitteroauth__consumer_key="${twitteroauth__consumer_key}"
119 export twitteroauth__consumer_secret="${twitteroauth__consumer_secret}"
120 export gitlaboauth__client_id="${gitlaboauth__client_id}"
121 export gitlaboauth__client_secret="${gitlaboauth__client_secret}"
122 export github__client_id="${github__client_id}"
123 export github__client_secret="${github__client_secret}"
124 export github__user_client_id="${github__user_client_id}"
125 export github__user_client_secret="${github__user_client_secret}"
126 export github__anonymous_app__client_id="${github__user_client_id}"
127 export github__anonymous_app__client_secret="${github__user_client_secret}"
128 export tokens__anonymousPassword="$(generate_password)"
129 export matrix__bridge__id="$(generate_password)"
130 export matrix__bridge__hsToken="$(generate_password)"
131 export matrix__bridge__asToken="$(generate_password)"
134 echo "You're good to go"
135 echo "Run 'source .env' to export your secret environment variables"
136 echo "Then run 'npm start'"