.env
Reference
A .env
file is a special file that is used to store configuration settings for SnailyCAD.
Reference
POSTGRES_PASSWORD
The password to the PostgreSQL database.
This password must not contain the following characters: #
, $
, "
, '
.
POSTGRES_USER
The username to the PostgreSQL database.
POSTGRES_DB
The database name. We recommend: snaily-cadv4
DB_HOST
The database host URL. Most likely localhost
.
Only when using Docker installation: change this to postgres
.
DB_PORT
The port to the database.
Only when using Docker installation: keep this as 5432
JWT_SECRET
This is a random value to keep the CAD secured.
This token must not contain the following characters: #
, $
, "
, '
.
CORS_ORIGIN_URL
& NEXT_PUBLIC_CLIENT_URL
The URL/IP to where the CAD is hosted at, see examples below.
In support, this will be called the client
.
Valid Examples:
https://cad.example.com
- subdomainhttps://mycad.com
- Top level domainhttp://192.168.0.190:3000
- LAN IP-addresshttp://83.39.20.30:3000
- WAN IP-address
Invalid Examples:
localhost
- will simply not work.cad.example.com
- missinghttps://
orhttp://
.http://192.168.x.x:3000
- default URL, will not work.
NEXT_PUBLIC_PROD_ORIGIN
The URL/IP to where the API is hosted at (/v1
is required.), see examples below.
In support, this will be called the API
.
Valid Examples:
https://cad-api.example.com/v1
- subdomainhttp://192.168.0.190:8080/v1
- LAN IP-addresshttp://83.39.20.30:8080/v1
- WAN IP-address
Invalid Examples:
https://cad-api.example.com
- missing/v1
cad-api.example.com
- missinghttps://
orhttp://
.localhost
- will simply not work.http://192.168.x.x:8080/v1
- default URL, will not work.
PORT_API
The port where the API should run on.
Default: 8080
PORT_API
The port where the API should run on.
Default: 8080
PORT_CLIENT
The port where the client should run on.
Default: 3000
ENCRYPTION_TOKEN
Used to generate encrypted values.
Generate one here
This token must be exactly 32 characters long.
DOMAIN
The domain you might be using. (Optional, however, recommended)
- You may only set this when using a domain name.
- This must be the TLD of the domain. (e.g.:
example.com
ormycommunity.com
)
Valid Examples:
example.com
example.com:3000
- a port can only be used when using a domain without SSL (https).
Invalid Examples:
cad.example.com
- subdomain cannot be used. must be top level domain192.38.33.29
- an IP is not a domain
SECURE_COOKIES_FOR_IFRAME
Only enable when uterly required. (This may not work all the time; work-in-progress.)
Example .env file
# Documentation can be found at: https://docs.snailycad.org/docs/guides/env/reference
# This is the password to the postgress database.
POSTGRES_PASSWORD="Y8CURkTv"
# This is the username to the postgress database.
POSTGRES_USER="postgres"
# The database host - Set as 'postgres' when using docker compose
DB_HOST="localhost"
# The database port - keep port as '5432' when using docker compose
DB_PORT="5432"
# The database name.
POSTGRES_DB="snaily-cad-v4"
# This is a random value to keep the CAD's cookies secured. Make sure to change this!
JWT_SECRET="GxuPM0XmlxvCDX0QfZeqLSo0uvNm3FsEZN56JRZYNSU="
# string of 32 characters long. Make sure to change this!
# Generate one at: https://codebeautify.org/generate-random-string
ENCRYPTION_TOKEN="BOqZR1ycU0zl6vEo64JgZB8BPtjcR7"
# This is the URL/IP to your site where the CAD is hosted.
# -> e.g. https://cad.mysite.com or http://99.99.00.190:3000
CORS_ORIGIN_URL="https://cad.example.com"
# The URL/IP to where the API is hosted.
# -> e.g. https://cad-api.mysite.com/v1 or http://99.99.00.190:8080/v1
NEXT_PUBLIC_PROD_ORIGIN="https://cad-api.example.com/v1"
# only enter this value if you're using a domain!
# domain should only be the domain, NOT including sub-domains
# example: `DOMAIN="example.com"`
DOMAIN="example.com"
# "true" or "false"
# Can only be enabled when having valid SSL (https) and a domain.
SECURE_COOKIES_FOR_IFRAME="false"
# The port of which the API will run on. Default: 8080
# When using Docker, make sure to change this in the `production.docker-compose.yml` file too.
PORT_API=8080
# The port of which the client will run on. Default: 3000
PORT_CLIENT=3000
# Do not change this.
NODE_ENV="production"
# Do not change this, unless you know what you're doing!
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}?sslmode=prefer