~girishm/op-mattermost

ref: 654a3956fcb041abf97ddc2b8c0467cb33cf6247 op-mattermost/configure.sh -rw-r--r-- 2.1 KiB
654a3956 — girish17 variable init 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# op-mattermost provides an integration for Mattermost and Open Project.
# Copyright (C) 2020  Girish M

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>

OK="n"

until [ $OK = "y" ]
do
    echo '\nPlease enter the following environment variables'
    read -p 'OP_URL (http://localhost:8080/api/v3): ' OP_URL
    if [ -z "$OP_URL" ]
    then
        OP_URL="http://localhost:8080/api/v3"
    fi
    read -p 'INT_URL (http://localhost:3000/): ' INT_URL
    if [ -z "$INT_URL" ]
    then
        INT_URL="http://localhost:3000"
    fi
    read -p 'MM_URL (http://localhost:8065/api/v4): ' MM_URL
    if [ -z "$MM_URL" ]
    then
        MM_URL="http://localhost:8065/api/v4"
    fi

    echo "\nPlease enter the generated access tokens for OpenProject and Mattermost"
    read -p 'MATTERMOST_ACCESS_TOKEN: ' MATTERMOST_ACCESS_TOKEN
    read -p 'MATTERMOST_SLASH_TOKEN: ' MATTERMOST_SLASH_TOKEN
    read -p 'OP_ACCESS_TOKEN: ' OP_ACCESS_TOKEN

    echo '\nInput environment variables:\n'
    echo OP_URL=$OP_URL
    echo INT_URL=$INT_URL
    echo MM_URL=$MM_URL
    echo MATTERMOST_ACCESS_TOKEN=$MATTERMOST_ACCESS_TOKEN
    echo MATTERMOST_SLASH_TOKEN=$MATTERMOST_SLASH_TOKEN
    echo OP_ACCESS_TOKEN=$OP_ACCESS_TOKEN

    read -p 'Is this OK (y/n) ? ' OK
    if [ -z "$OK" ]
    then
        OK="n"
    fi
done
echo '\nGenerating .env file...'
ENV_CONTENTS='OP_URL='$OP_URL'/\nINT_URL='$INT_URL'/\nMM_URL='$MM_URL'/\nMATTERMOST_ACCESS_TOKEN='$MATTERMOST_ACCESS_TOKEN'\nMATTERMOST_SLASH_TOKEN='$MATTERMOST_SLASH_TOKEN'\nOP_ACCESS_TOKEN='$OP_ACCESS_TOKEN

touch .env
echo $ENV_CONTENTS > .env
echo '\nDone.'