From c8e8ca7415922f74b5f4b2ca498c91d00c747238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PICHOU=20Ky=C3=A2ne?= <kyane.pichou@etu.utc.fr> Date: Sat, 11 Mar 2017 19:25:58 +0100 Subject: [PATCH] Manage mattermost giphy token at startup (and not when building docker image) --- mattermost-giphy/.gitignore | 1 - mattermost-giphy/README.md | 7 ------- ...iphy_mat_hooker.conf.template => giphy_mat_hooker.conf} | 7 +++---- mattermost-giphy/init.sh | 3 +++ 4 files changed, 6 insertions(+), 12 deletions(-) delete mode 100644 mattermost-giphy/.gitignore delete mode 100644 mattermost-giphy/README.md rename mattermost-giphy/{giphy_mat_hooker.conf.template => giphy_mat_hooker.conf} (85%) diff --git a/mattermost-giphy/.gitignore b/mattermost-giphy/.gitignore deleted file mode 100644 index 335954ca..00000000 --- a/mattermost-giphy/.gitignore +++ /dev/null @@ -1 +0,0 @@ -giphy_mat_hooker.conf diff --git a/mattermost-giphy/README.md b/mattermost-giphy/README.md deleted file mode 100644 index bb0283eb..00000000 --- a/mattermost-giphy/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Instructions - -You should set the `giphy_mat_hooker.conf` file. -``` -cp giphy_mat_hooker.conf.template giphy_mat_hooker.conf -``` -Change the `token` value with the mattermost key diff --git a/mattermost-giphy/giphy_mat_hooker.conf.template b/mattermost-giphy/giphy_mat_hooker.conf similarity index 85% rename from mattermost-giphy/giphy_mat_hooker.conf.template rename to mattermost-giphy/giphy_mat_hooker.conf index 68bab70a..81375c80 100644 --- a/mattermost-giphy/giphy_mat_hooker.conf.template +++ b/mattermost-giphy/giphy_mat_hooker.conf @@ -1,4 +1,3 @@ -# vim:set sw=4 ts=4 sts=4 ft=perl expandtab: { #################### # Hypnotoad settings @@ -6,7 +5,7 @@ # see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings hypnotoad => { # array of IP addresses and ports you want to listen to - listen => ['http://127.0.0.1:80'], + listen => ['http://0.0.0.0:8080'], }, ###################### @@ -17,7 +16,7 @@ # The default is the dev key from Giphy, which is rate-limited. # See https://github.com/Giphy/GiphyAPI to know how to get # a production API key - apikey => 'dc6zaTOxFJmzC', + apikey => '{{%APIKEY%}}', # Mattermost token # When you create a slash command in mattermost, you get a token. @@ -25,5 +24,5 @@ # only. # If you do not provide a token, it will check for parameters that # Mattermost usually send with a slash command. - token => 'something' + token => '{{%TOKEN%}}' }; diff --git a/mattermost-giphy/init.sh b/mattermost-giphy/init.sh index 1db579ce..77ee328f 100644 --- a/mattermost-giphy/init.sh +++ b/mattermost-giphy/init.sh @@ -1,5 +1,8 @@ #!/bin/bash +sed -i "s/{{%TOKEN%}}/$MATTERMOST_TOKEN/g" giphy_mat_hooker.conf +sed -i "s/{{%APIKEY%}}/$GIPHY_APIKEY/g" giphy_mat_hooker.conf + carton exec hypnotoad script/giphy_mat_hooker while :; do -- GitLab