Run social poster only in prod (#2077)

This commit is contained in:
ekzyis 2025-04-07 23:51:33 +02:00 committed by GitHub
parent 40cd0ea422
commit f43a522a87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,8 +2,11 @@ import Nostr from '@/lib/nostr'
import { TwitterApi } from 'twitter-api-v2' import { TwitterApi } from 'twitter-api-v2'
import { msatsToSats, numWithUnits } from '@/lib/format' import { msatsToSats, numWithUnits } from '@/lib/format'
const isProd = process.env.NODE_ENV === 'production'
async function postToTwitter ({ message }) { async function postToTwitter ({ message }) {
if (!process.env.TWITTER_POSTER_API_KEY || if (!isProd ||
!process.env.TWITTER_POSTER_API_KEY ||
!process.env.TWITTER_POSTER_API_KEY_SECRET || !process.env.TWITTER_POSTER_API_KEY_SECRET ||
!process.env.TWITTER_POSTER_ACCESS_TOKEN || !process.env.TWITTER_POSTER_ACCESS_TOKEN ||
!process.env.TWITTER_POSTER_ACCESS_TOKEN_SECRET) { !process.env.TWITTER_POSTER_ACCESS_TOKEN_SECRET) {
@ -38,7 +41,7 @@ const RELAYS = [
] ]
async function postToNostr ({ message }) { async function postToNostr ({ message }) {
if (!process.env.NOSTR_PRIVATE_KEY) { if (!isProd || !process.env.NOSTR_PRIVATE_KEY) {
console.log('Nostr poster not configured') console.log('Nostr poster not configured')
return return
} }