Skip to content

Environment Variables

Everything that can be changed between various deployments of Ving from QA to Production to individual developer laptops is controlled in the .env file in the root of the ving project folder. Thus .env is excluded from git, as it should be different for each deployment. We then make use of these variables through Node's --env-file CLI parameter.

There are two types of variables that can end up in .env, editable and generated variables.

Editable Variables

Editable Variables are variables that you, the developer or devops person, are required to provide.

VING_SKIPJACK_KEY

This sets the encryption key for the algorithm that obsucates database IDs in URLs making them unguessable to the public. It should be a series of 1 to 10 random numbers separated by commas.

bash
VING_SKIPJACK_KEY=3,493,19,1,5,7,11,9393,11,19429

Note that changing this after your site is in the wild will change all the keys that external users may have stored in their use of your Rest endpoints. Also, if you don't set this we'll just use our own set of numbers, but then anybody that has access to the Ving source code could figure out the values of your ids.

VING_MYSQL

bash
VING_MYSQL="mysql://ving:fdsfdsfdsdsf@localhost:3380/ving"

You can also add log=yes to the end if you would like to see all SQL queries end up in your ving.log for debugging purposes.

bash
VING_MYSQL="mysql://ving:ksdksdfllsdf@localhost:3380/ving?log=yes"

VING_SMTP

The configuration URL for your SMTP server.

bash
VING_SMTP="smtp://AKIAdsfadasfTZZD:BadsfsdfsdsLL@email-smtp.us-east-1.amazonaws.com:465/?tls=yes&log=yes"

The tls and log sections on the end of the URL are optional. Remove the tls section if your SMTP server doesn't support TLS encrypted communication. And remove the log section if you don't want to put every email outcome into your ving.log.

VING_EMAIL_OVERRIDE

If this exists, all outgoing emails will go to this email address instead of their intended address. This is of course great for development purposes, and should not be used in production.

bash
VING_EMAIL_OVERRIDE="mytestemail@gmail.com"

VING_REDIS

A connection string to your Redis install.

bash
VING_REDIS="redis://localhost:6379"

Can also include username and password like this:

bash
VING_REDIS="redis://user:pass@localhost:6379"

If you're using Redis Cluster, you can add ?cluster=yes to the end of the URL.

Note that if you're hosting on AWS, all Redis instances there have TLS enabled by default, so the URL prefix will have 2 's' at the end like this: rediss://.

AWS_ACCESS_KEY_ID

The access key that will be used to deploy resources and access S3.

bash
AWS_ACCESS_KEY_ID="JKHHGJKLHHGKL"

AWS_SECRET_ACCESS_KEY

The secret access key for AWS that will be used to deploy resources and access S3.

bash
AWS_SECRET_ACCESS_KEY="afsdlkjlkafsjdlkjasfdkjlalskfasdf"

AWS_REGION

The AWS region you want to deploy services in.

bash
AWS_REGION="us-east-1"

VING_SITE_URL

The URL of this site as it should appear in generated URLs. Should not end in a /.

bash
VING_SITE_URL="http://localhost:3000"

Generated Variables

Generated variables are generated by one of Ving's subsystems, usually CDK, for resources that are automatically configured and then must be referenced later.

VING_LAMBDA_PROCESS_UPLOADS_URL

This is the location of the AWS Lambda function that post processes S3File uploads.

bash
VING_LAMBDA_PROCESS_UPLOADS_URL="https://yvgmjfp5c7aasfdgf3efqhy0vbkll.lambda-url.us-east-1.on.aws/"

VING_AWS_UPLOADS_BUCKET

This is the name of the S3 bucket that will hold S3File uploads.

bash
VING_AWS_UPLOADS_BUCKET="ving-dev-uploads-ea6sd53e"

VING_AWS_UPLOADS_KEY

The the IAM key that will be used to grant users access to upload a file to the VING_AWS_UPLOADS_BUCKET.

bash
VING_AWS_UPLOADS_KEY="dssasdflkjadfslasfdRE7IQ"

VING_AWS_UPLOADS_SECRET

The the IAM secret that will be used to grant users access to upload a file to the VING_AWS_UPLOADS_BUCKET.

bash
VING_AWS_UPLOADS_SECRET="sssljadsflkjalsdfslfNLzO"

VING_AWS_THUMBNAILS_BUCKET

This is the name of the S3 bucket that will hold S3File uploads generated thumbnails.

bash
VING_AWS_THUMBNAILS_BUCKET="ving-dev-thumbnails-6dsd53cc"

ving.json

As a side note there is also a ving.json file. That is used to store configurable data that does not change between modes of deployment. Usually you'll set this data when you set up your project, and then likely will never change it again.

site

This section deals with data relating to the site.

site.email

The email address that messages generated by the site should come from by default.

json
"email": "info@example.com",

site.name

The name of this site.

json
"name": "ving",

site.logoUrl

The relative path of a logo in your repo to display in emails and on the site.

json
"logoUrl": "/ving.svg",

site.streetAddress

An array containing the physical street address of the entity that owns the site. This is required for compliance with anti-spam laws.

json
"streetAddress": [
    "123 Main Street",
    "Madison, WI 53701",
    "USA"
]