From 4ecd603c9117088d9abf59111fdf34948bb19a62 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 15:40:18 +0100 Subject: [PATCH] Add giphy mattermost integration --- mattermost-giphy/.gitignore | 1 + mattermost-giphy/Dockerfile | 20 +++++++++++++ mattermost-giphy/README.md | 7 +++++ .../giphy_mat_hooker.conf.template | 29 +++++++++++++++++++ mattermost-giphy/init.sh | 7 +++++ 5 files changed, 64 insertions(+) create mode 100644 mattermost-giphy/.gitignore create mode 100644 mattermost-giphy/Dockerfile create mode 100644 mattermost-giphy/README.md create mode 100644 mattermost-giphy/giphy_mat_hooker.conf.template create mode 100644 mattermost-giphy/init.sh diff --git a/mattermost-giphy/.gitignore b/mattermost-giphy/.gitignore new file mode 100644 index 00000000..335954ca --- /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 00000000..039991c9 --- /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 00000000..bb0283eb --- /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 00000000..68bab70a --- /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 00000000..1db579ce --- /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 -- GitLab