Skip to content

Environment Variables

Reme Le Hane edited this page Sep 29, 2021 · 3 revisions

IN order to run locally or deployed, certain environment variables need to be configured, here is a sample of an env file that can be populated and loaded into your machine's environment.

PORT=
GIN_MODE=

# Twitter
CONSUMER_KEY=
CONSUMER_SECRET=
ACCESS_TOKEN=
ACCESS_TOKEN_SECRET= 

#Sentry
SENTRY_DNS=

# Postgress
DATABASE_URL=

# Scheduler
SCHEDULE_TYPE=
SCHEDULES=
SCHEDULE_DAYS=
INTERVALS=
CRON_SCHEDULE=

# Token
TOKEN_VALIDITY_HOURS=
ENABLE_CREATE=

What they all mean and how to set them up:

  • PORT - exposed web port
  • GIN_MODE - release for release or debug for local dev
  • Twitter Credentials - available from Twitter
  • SENTRY_DNS - optional, for debug logging.
  • DATABASE_URL - PG database URL, eg (postgres://un:pass@domain:port/database)
  • SCHEDULE_TYPE - Either INTERVAL, FIXED or RANDOM_MINUTE
  • SCHEDULES - Depends on schedule type
    • FIXED - A comma-separated list of time slots, eg "01:53,03:17,05:21,06:09,08:11", 24hr time
    • RANDOM_MINUTE - A comma-separated list of "hours", eg "1,3,5,6,8"
  • ** SCHEDULE_DAYS** A comma-separated list of weekdays on which you want automated posts to be scheduled, for example: "Monday,Tuesday,Wednesday,Thursday,Friday", meaning no posts would be scheduled for a Saturday or Sunday
  • INTERVAL - when the type is set as INTERVAL, provide a number to denote hours between posts, eg 3.
  • CRON_SCHEDULE - Cron string to control the schedulers checking of the DB for pending posts, default: "*/5 6-18 * * *"
  • TOKEN_VALIDITY_HOURS - Default number of hours a token is valid for, can be overridden with the create request
  • ENABLE_CREATE - Defines how token creation endpoint works.
    • OPEN: should only be used during initial setup, anyone will be able to create token in this state
    • SCOPED: should be used once a token with the scope of "token:create" exists for creating additional tokens
    • DISABLED: to completely disable the creating of tokens
Clone this wiki locally