Skip to content

Commit 77171b0

Browse files
authored
Merge pull request #266 from github/users/aasiddiq/chat_integration_settings
Added settings to be backed up for Chat Integration
2 parents 6506931 + d41296d commit 77171b0

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

share/github-backup-utils/ghe-backup-settings

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,38 @@ if ghe-ssh "$host" -- ghe-config --true app.packages.enabled; then
132132
backup-secret "Packages azure container name" "packages-azure-container-name" "secrets.packages.azure-container-name"
133133
fi
134134

135+
# Backup Chat Integration settings
136+
if ghe-ssh "$host" -- ghe-config --true app.chatops.enabled; then
137+
backup-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id"
138+
backup-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password"
139+
backup-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint"
140+
backup-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle"
141+
backup-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name"
142+
backup-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id"
143+
backup-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id"
144+
backup-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret"
145+
backup-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token"
146+
backup-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token"
147+
backup-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint"
148+
backup-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret"
149+
backup-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token"
150+
backup-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command"
151+
backup-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name"
152+
backup-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode"
153+
backup-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint"
154+
backup-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type"
155+
backup-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams"
156+
backup-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams"
157+
backup-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams"
158+
backup-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams"
159+
backup-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret"
160+
backup-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret"
161+
backup-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack"
162+
backup-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack"
163+
backup-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack"
164+
backup-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack"
165+
fi
166+
135167
if ghe-ssh "$host" -- "test -f $GHE_REMOTE_DATA_USER_DIR/common/idp.crt"; then
136168
echo "* Transferring SAML keys ..." 1>&3
137169
ghe-ssh $host -- sudo tar -C $GHE_REMOTE_DATA_USER_DIR/common/ -cf - "idp.crt saml-sp.p12" > saml-keys.tar
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
#/ Usage: ghe-restore-chat-integration <host>
3+
#/
4+
#/ Note: This script typically isn't called directly. It's invoked by the
5+
#/ ghe-restore command.
6+
set -e
7+
8+
# Bring in the backup configuration
9+
# shellcheck source=share/github-backup-utils/ghe-backup-config
10+
. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config"
11+
12+
# Show usage and bail with no arguments
13+
[ -z "$*" ] && print_usage
14+
15+
bm_start "$(basename $0)"
16+
17+
# Grab host arg
18+
GHE_HOSTNAME="$1"
19+
20+
# The snapshot to restore should be set by the ghe-restore command but this lets
21+
# us run this script directly.
22+
: ${GHE_RESTORE_SNAPSHOT:=current}
23+
24+
# Path to snapshot dir we're restoring from
25+
export GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"
26+
27+
port=$(ssh_port_part "$GHE_HOSTNAME")
28+
export port
29+
host=$(ssh_host_part "$GHE_HOSTNAME")
30+
31+
# Perform a host-check and establish GHE_REMOTE_XXX variables.
32+
ghe_remote_version_required "$host"
33+
34+
# Restore Chat Integration settings.
35+
ghe_verbose "Restoring Chat Integration settings ..."
36+
37+
restore-secret "Chat Integration MSTeams app id" "chatops-msteams-app-id" "secrets.chatops.msteams.app-id"
38+
restore-secret "Chat Integration MSTeams app password" "chatops-msteams-app-password" "secrets.chatops.msteams.app-password"
39+
restore-secret "Chat Integration MSTeams public endpoint" "chatops-msteams-app-public-endpoint" "secrets.chatops.msteams.public-endpoint"
40+
restore-secret "Chat Integration MSTeams bot handle" "chatops-msteams-bot-handle" "secrets.chatops.msteams.bot-handle"
41+
restore-secret "Chat Integration MSTeams bot name" "chatops-msteams-bot-name" "secrets.chatops.msteams.bot-name"
42+
restore-secret "Chat Integration Slack app id" "chatops-slack-app-id" "secrets.chatops.slack.app-id"
43+
restore-secret "Chat Integration Slack client id" "chatops-slack-client-id" "secrets.chatops.slack.client-id"
44+
restore-secret "Chat Integration Slack client secret" "chatops-slack-client-secret" "secrets.chatops.slack.client-secret"
45+
restore-secret "Chat Integration Slack verification token" "chatops-slack-verification-token" "secrets.chatops.slack.verification-token"
46+
restore-secret "Chat Integration Slack config token" "chatops-slack-config-token" "secrets.chatops.slack.config-token"
47+
restore-secret "Chat Integration Slack public endpoint" "chatops-slack-public-endpoint" "secrets.chatops.slack.public-endpoint"
48+
restore-secret "Chat Integration Slack signing secret" "chatops-slack-signing-secret" "secrets.chatops.slack.signing-secret"
49+
restore-secret "Chat Integration Slack app level token" "chatops-slack-app-level-token" "secrets.chatops.slack.app-level-token"
50+
restore-secret "Chat Integration Slack slack command" "chatops-slack-slash-command" "secrets.chatops.slack.slash-command"
51+
restore-secret "Chat Integration Slack app name" "chatops-slack.app-name" "secrets.chatops.slack.app-name"
52+
restore-secret "Chat Integration Slack socket mode" "chatops-slack.socket-mode" "secrets.chatops.slack.socket-mode"
53+
restore-secret "Chat Integration public endpoint" "chatops-public-endpoint" "secrets.chatops.public-endpoint"
54+
restore-secret "Chat Integration app type" "chatops-app-type" "secrets.chatops.app-type"
55+
restore-secret "Chat Integration app id teams" "chatops-app-id-teams" "secrets.chatops.app-id-teams"
56+
restore-secret "Chat Integration webhook secret teams" "chatops-webhook-secret-teams" "secrets.chatops.webhook-secret-teams"
57+
restore-secret "Chat Integration client secret teams" "chatops-client-secret-teams" "secrets.chatops.client-secret-teams"
58+
restore-secret "Chat Integration clien id teams" "chatops-client-id-teams" "secrets.chatops.client-id-teams"
59+
restore-secret "Chat Integration storage secret" "chatops-storage-secret" "secrets.chatops.storage-secret"
60+
restore-secret "Chat Integration session secret" "chatops-session-secret" "secrets.chatops.session-secret"
61+
restore-secret "Chat Integration app id slack" "chatops-app-id-slack" "secrets.chatops.app-id-slack"
62+
restore-secret "Chat Integration webhook secret slack" "chatops-webhook-secret-slack" "secrets.chatops.webhook-secret-slack"
63+
restore-secret "Chat Integration client secret slack" "chatops-client-secret-slack" "secrets.chatops.client-secret-slack"
64+
restore-secret "Chat Integration client id slack" "chatops-client-id-slack" "secrets.chatops.client-id-slack"
65+
66+
bm_end "$(basename $0)"

share/github-backup-utils/ghe-restore-settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ restore-secret "external MySQL password" "external-mysql-password" "secrets.exte
3636
echo "Restoring packages settings ..."
3737
ghe-restore-packages "$GHE_HOSTNAME" 1>&3
3838

39+
echo "Restoring chat integration settings ..."
40+
ghe-restore-chat-integration "$GHE_HOSTNAME" 1>&3
41+
3942
# work around issue importing settings with bad storage mode values
4043
( cat "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" && echo ) |
4144
sed 's/"storage_mode": "device"/"storage_mode": "rootfs"/' |

0 commit comments

Comments
 (0)