Skip to content

Commit

Permalink
configure atproto passwords in infra
Browse files Browse the repository at this point in the history
  • Loading branch information
amatissart committed Jan 30, 2025
1 parent a9ddea0 commit 696f4e8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 1 addition & 3 deletions backend/twitterbot/models/tweeted.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def bluesky_url(self):
r"at://(?P<authority>.+)/(?P<collection>.+)/(?P<key>.+)",
self.atproto_uri,
)
if not match:
return None
if match.group("collection") != "app.bsky.feed.post":
if not match or match.group("collection") != "app.bsky.feed.post":
return None
return f"https://bsky.app/profile/{match.group('authority')}/post/{match.group('key')}"

Expand Down
4 changes: 4 additions & 0 deletions infra/ansible/roles/django/templates/settings.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,17 @@ TWITTERBOT_CREDENTIALS:
"CONSUMER_SECRET": "{{consumer_secret_twitterbot_fr}}",
"ACCESS_TOKEN": "{{access_token_twitterbot_fr}}",
"ACCESS_TOKEN_SECRET": "{{access_token_secret_twitterbot_fr}}",
"ATPROTO_HANDLE": "tournesolbotfr.tournesol.app",
"ATPROTO_PASSWORD": "{{atproto_password_tournesolbot_fr}}",
}
"@TournesolBot": {
"LANGUAGE": "en",
"CONSUMER_KEY": "{{consumer_key_twitterbot_en}}",
"CONSUMER_SECRET": "{{consumer_secret_twitterbot_en}}",
"ACCESS_TOKEN": "{{access_token_twitterbot_en}}",
"ACCESS_TOKEN_SECRET": "{{access_token_secret_twitterbot_en}}",
"ATPROTO_HANDLE": "tournesolbot.tournesol.app",
"ATPROTO_PASSWORD": "{{atproto_password_tournesolbot_en}}",
}

DISCORD_CHANNEL_WEBHOOKS: {
Expand Down
2 changes: 2 additions & 0 deletions infra/ansible/scripts/deploy-without-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ ansible-playbook -i inventory.yml -l "$ANSIBLE_HOST" "$SETUP_FILE" \
-e "discord_infra_alert_private_webhook=${DISCORD_INFRA_ALERT_PRIVATE_WEBHOOK:-""}" \
-e "discord_twitter_webhook=${DISCORD_TWITTER_WEBHOOK:-""}" \
-e "plausible_analytics_secret_key=$PLAUSIBLE_ANALYTICS_SECRET_KEY" \
-e "atproto_password_tournesolbot_fr=$ATPROTO_PASSWORD_BOT_FR" \
-e "atproto_password_tournesolbot_en=$ATPROTO_PASSWORD_BOT_EN" \
2 changes: 2 additions & 0 deletions infra/ansible/scripts/forget-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ unset DISCORD_INFRA_ALERT_WEBHOOK
unset DISCORD_INFRA_ALERT_PRIVATE_WEBHOOK
unset DISCORD_TWITTER_WEBHOOK
unset PLAUSIBLE_ANALYTICS_SECRET_KEY
unset ATPROTO_PASSWORD_BOT_FR
unset ATPROTO_PASSWORD_BOT_EN
6 changes: 6 additions & 0 deletions infra/ansible/scripts/get-vm-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ export DISCORD_TWITTER_WEBHOOK

PLAUSIBLE_ANALYTICS_SECRET_KEY="$(ssh "$VM_USER@$VM_ADDR" -- sudo cat /root/plausible_analytics_secret_key)"
export PLAUSIBLE_ANALYTICS_SECRET_KEY

ATPROTO_PASSWORD_BOT_FR=$(get_settings_value .TWITTERBOT_CREDENTIALS.\"@TournesolBotFR\".ATPROTO_PASSWORD)
export ATPROTO_PASSWORD_BOT_FR

ATPROTO_PASSWORD_BOT_EN=$(get_settings_value .TWITTERBOT_CREDENTIALS.\"@TournesolBot\".ATPROTO_PASSWORD)
export ATPROTO_PASSWORD_BOT_EN

0 comments on commit 696f4e8

Please sign in to comment.