# This is a base file for configuring the speckle server. Steps:
# 2. Copy it to .env ( `cp .env-base .env`)
# 2. Configure the .env file with your settings.
# 3. Start the speckle server!
#
# NOTE: If these are set through a different process, eg docker, pm2, or command line
# they will not be overwritten.

# SERVER_NAME: The server name is important, as it will help users differentiate
# between multiple accounts.
SERVER_NAME="Please Change My Name Server"

# CANONICAL_URL: The url address (if you have any) where this server exists. For example,
# a canonical url can be "https://hestia.speckle.works".
CANONICAL_URL="http://localhost:3000"

# PUBLIC_STREAMS: Wether all streams created should be public (true) or private (false)
# by default.
PUBLIC_STREAMS=true

# PLUGIN_DIRS: Dirs to scan for speckle plugins (comma separated). For example, if you install
# some other modules in `./test` and `./wonderful`, you could use PLUGIN_DIRS="./test,./wonderful"
PLUGIN_DIRS="./node_modules/@speckle,./plugins"

# PORT: The port you want the speckle server to run on. Make sure the port is accesible
# if you have any firewalls set up (ie, ufw).
PORT=3000

# IP: The ip to listen to
# Defaults to all IPs bound to this machine, and all IPv6 IPs if IPv6 is enabled.
# If you want to bind to IPv4 only, or a specific IPv6/v4 address, uncomment the line below and specifiy your preferred address.
# IP=127.0.0.1

# MAX_PROC: The maximum amount of service workers to start. If this is not specified,
# Speckle will fork out as many as the machine's processor cores. To specify it,
# just uncomment the line below.
MAX_PROC=1

# REQ_SIZE: The request size protects your server from being flooded with too much data.
REQ_SIZE=10mb

# This is used in the encryption of the api access tokens.
# Please change it to something random!
SESSION_SECRET="helloworld"

#
# DBs
#

# Mongodb URI: this is the uri string that the server will use to connect to your mongo instance.
# The default string below will work with an out-of-the-box local mongodb deployment.
# For more info, see: https://docs.mongodb.com/manual/reference/connection-string/
MONGODB_URI="mongodb://localhost:27017/speckle"

# Redis URI: this is the uri string that the server will use to connect to your redis instance.
# The default string should work with an out-of-the-box local redis deployment.
# For more info, see http://www.iana.org/assignments/uri-schemes/prov/redis
REDIS_URL="redis://localhost:6379"


#
# Housekeeping
#

# If you want your api calls to return pretty json, set this to true. It will cause
# the reponses to be ±10% bigger.
INDENT_RESPONSES=false

# If you want user email addresses to be publicly visible, set this to true.
EXPOSE_EMAILS=false

# The first user to register gets a server admin role.
# A server admin is allowed access to all resources on this server.
FIRST_USER_ADMIN=true

#
# Email sending
# This is future functionality that will be used for password resets, email
# confirmation, etc. when using the default auth strategy. It will also be used
# to send notifications (not in the near future though).
#

# SMTP server
# This section is used to send emails out. You can use the provider of your choice,
# as long as it exposes an SMTP server that you can use. Some of these providers are:
# sparkpost, mailgun, sendgrid.
SMTP_HOST="CHANGE_ME"
SMTP_PORT=587
SMPT_USERNAME="CHANGE_ME"
SMPT_PASSWORD="CHANGE_ME"

# Will populate the `from:` field in any emails this server sends. Please note, some
# providers will require to verify your domain first.
EMAIL_SENDER="please_change_this@whatever.com"

#
# Authentication Strategies
#

# Set to false to disable register routes
PUBLIC_REGISTRATION=false

# Local
# Local is the default auth strategy for speckle (email + password).
# If this strategy is disabled, the api routes for registering and logging in will not work.
USE_LOCAL=true

# Auth0
# https://auth0.com
USE_AUTH0=false
AUTH0_CLIENT_ID="CHANGE_ME"
AUTH0_DOMAIN="CHANGE_ME"
AUTH0_CLIENT_SECRET="CHANGE_ME"

# Azure AD
# https://azure.microsoft.com/en-gb/services/active-directory/
USE_AZUREAD=false
AZUREAD_ORG_NAME="CHANGE_ME"
AZUREAD_CLIENT_ID="CHANGE_ME"
AZUREAD_IDENTITY_METADATA="CHANGE_ME"
AZUREAD_CLIENT_SECRET="CHANGE_ME"

# Github
# https://github.com/jaredhanson/passport-github
USE_GITHUB=false
GITHUB_CLIENT_ID="CHANGE_ME"
GITHUB_CLIENT_SECRET="CHANGE_ME"
GITHUB_CALLBACK="CHANGE_ME"

# Whitelisted domains
# Add here any other places that you trust this server to redirect to once authentication is done.
REDIRECT_URLS="http://localhost:5050,https://localhost:8080,https://app.speckle.systems"

# Wether to allow non http*s* redirect urls.
# "localhost" redirect urls will always work with or without TLS.
ALLOW_INSECURE_REDIRECTS=false

