diff --git a/mattermost-giphy/.gitignore b/mattermost-giphy/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..335954ca647702f828f85c7ca2e3da1b339e1c2c --- /dev/null +++ b/mattermost-giphy/.gitignore @@ -0,0 +1 @@ +giphy_mat_hooker.conf diff --git a/mattermost-giphy/Dockerfile b/mattermost-giphy/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..039991c9bc798adf6174b6e258b69fd6bc272376 --- /dev/null +++ b/mattermost-giphy/Dockerfile @@ -0,0 +1,20 @@ +FROM perl + +MAINTAINER Kyâne PICHOU kyane@kyane.fr + +# Install CPAN and Carton +RUN apt-get update \ + && apt-get -y install build-essential libssl-dev \ + && curl -L http://cpanmin.us | perl - App::cpanminus \ + && cpanm Carton + +RUN git clone https://git.framasoft.org/framasoft/giphymathooker.git /giphymathooker +WORKDIR /giphymathooker + +RUN carton install +COPY giphy_mat_hooker.conf /giphymathooker/giphy_mat_hooker.conf +COPY init.sh /giphymathooker/init.sh +RUN chmod +x /giphymathooker/init.sh + +EXPOSE 8080 +ENTRYPOINT ["/giphymathooker/init.sh"] diff --git a/mattermost-giphy/README.md b/mattermost-giphy/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bb0283eb13001cfcaffc0027df5e12fe0ffac650 --- /dev/null +++ b/mattermost-giphy/README.md @@ -0,0 +1,7 @@ +# 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.template new file mode 100644 index 0000000000000000000000000000000000000000..68bab70a99d545eb73d0d2671fb7e4e1df6799da --- /dev/null +++ b/mattermost-giphy/giphy_mat_hooker.conf.template @@ -0,0 +1,29 @@ +# vim:set sw=4 ts=4 sts=4 ft=perl expandtab: +{ + #################### + # Hypnotoad settings + #################### + # 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'], + }, + + ###################### + # Application settings + ###################### + + # Giphy API key. + # 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', + + # Mattermost token + # When you create a slash command in mattermost, you get a token. + # Put it here if you want that service to be available to your team + # only. + # If you do not provide a token, it will check for parameters that + # Mattermost usually send with a slash command. + token => 'something' +}; diff --git a/mattermost-giphy/init.sh b/mattermost-giphy/init.sh new file mode 100644 index 0000000000000000000000000000000000000000..1db579ce8bdd3a0de51ea0960b35eddea42fe2ad --- /dev/null +++ b/mattermost-giphy/init.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +carton exec hypnotoad script/giphy_mat_hooker + +while :; do + sleep 300 +done