mattermost-community / mattermost-plugin-welcomebot

Apache License 2.0
66 stars 41 forks source link

How to add welcome message in k8s environment #56

Open erezo9 opened 4 years ago

erezo9 commented 4 years ago

Hi, How can i add a welcome message in a k8s environment? I can control the plugin using mattermost cli, but the config.json management is a bit of an issue to edit cause it will not save in the db

nicolas-goudry commented 3 years ago

@erezo9 I’m using the operator and had to setup the welcome bot directly in database.

First, get the current configuration from database (you’ll need mysql client and jq):

$ mysql -h [host] -u [user] -p -N -B [database] -e "SELECT Value FROM Configurations WHERE Active = 1;" | sed 's/\\n//g' | jq . > mm-config.json

Edit the configuration file to setup the welcome bot as you wish, then save back the JSON as a one-liner to be saved in db:

$ cat mm-config.json | sed -z 's/\n/\\n/g;s/"/\\"/g;s/\\n$//' > mm-config-oneline.json

Finally, update configuration in database:

mysql -h [host] -u [user] -p -N -B [database] -e "UPDATE Configurations SET Active = NULL WHERE Active = 1;INSERT INTO Configurations (Id, Value, CreateAt, Active) VALUES (\"`uuidgen | base32 | cut -c 1-26 | tr '[:upper:]' '[:lower:]'`\", \"`cat mm-config-oneline.json`\", `date +%s%N`, 1);"

It’s not ideal, but it works (or seems to).

Kshitij-Katiyar commented 6 months ago

@erezo9 @nicolas-goudry We have an open PR to add the plugin configuration for the welcome bot plugin outside the server config.json file and through the plugin configuration. So I think that should solve the issue you are having. https://github.com/mattermost/mattermost-plugin-welcomebot/pull/126 cc: @mickmister We can close this issue after merging this PR.