Environments

There are three environments in powershaper/config/settings:

  • local - used for local development

  • production - used on both production and staging

  • test - used for testing

Plus ‘base’, which is included by all of them.

These files contain as many settings as possible. However API keys and secrets should not be kept here but rather should be set using environment variables. A list of these are below.

URLs/endpoints that do not change from environment to environment are best kept in the configuration files, and not set as environment variables.

Everything that comes from an environment variable should be defined in base.py.

Environment variables

External service integrations

Env var

Purpose

USE_AUTH_SERVICE

Login system (default to False for Django’s builtin)

AUTH0_CLIENT_ID

Login system

AUTH0_CLIENT_SECRET

Login system

DJANGO_AWS_ACCESS_KEY_ID

Amazon S3 access for storing static files

DJANGO_AWS_SECRET_ACCESS_KEY

Amazon S3 access for storing static files

DJANGO_AWS_STORAGE_BUCKET_NAME

Amazon S3 access for storing static files

HUB_SITE_URL

URL of the Carbon Co-op Hub site for this environment

HUB_API_KEY

An API authentication token for the Hub on the above URL

MAILGUN_API_KEY

Sending transactional emails

MAILGUN_API_URL

Sending transactional emails

MAILGUN_DOMAIN

Sending transactional emails

SENTRY_DSN

Logging exceptions to Sentry for better error discovery

SLACK_POST_SMART_METERS_URL

Incoming Slack webhook URL corresponding to #smart-meter-alerts

STRIPE_PUBLISHABLE_KEY

Public key for Stripe payments integration

STRIPE_SECRET_KEY

Secret key for Stripe payments integration

STRIPE_ENDPOINT_SECRET

Webhook signing secret key for validating incoming webhooks

VTN_API_URL

Base URL for the VTN API for this environment

VTN_API_KEY

API authentication token for the VTN on the above URL

VTN_GUI_URL

URL for the VTN admin system for this environment

BALENA_TOKEN

API authentication for balena cloud device management

PS_TELEMETRY_URL

URL of Carbon Co-op’s InfluxCloud instance

PS_TELEMETRY_BUCKET

Bucket for data on InfluxCloud

PS_TELEMETRY_TOKEN

API authentication for InfluxCloud

METERS_SIGNUP_GFORM

URL for PowerShaper Monitor expression of interest form

LOVE2SHOP_SUBSCRIPTION_KEY

Subscription key for Love2Shop API integration

LOVE2SHOP_CLIENT_ID

Client ID for Love2Shop API integration

LOVE2SHOP_CLIENT_SECRET

Secret Key for Love2Shop API integratino

PowerShaper settings

Env var

Description

DATABASE_URL

URL to access the DB in postgress://user@pass:host/db format

DJANGO_ADMIN_URL

URL on the site where you can access Django admin backend (defaults to ‘admin’)

DJANGO_ALLOWED_HOSTS

A list of hostnames where this site will respond

DJANGO_SECRET_KEY

Secret key for session storage

DJANGO_SETTINGS_MODULE

Which settings module to use, in dotted form (config.settings.production)

EMAIL_REDIRECT_TO

Redirect all outgoing emails to this address (useful for testing on staging)

ENV

production or staging (currently only used to choose what S3 bucket static file go into)

REDIS_DB

Redis configuration

REDIS_HOST

Redis configuration

REDIS_PASSWORD

Redis configuration

REDIS_PORT

Redis configuration

REDIS_SSL

Redis configuration

SITE_URL

URL that the site is running on, e.g. https://app.powershaper.io.

HILDEBRAND_BACKEND

Boolean to flag use of the Hildebrand smart meter data service