Frontend configuration options

Name Type Env Values Default Description
Env string ENV prod, dev, test prod Server mode
TmpDir string TMP_DIR tmp Temporary files dir
NoLog bool NO_LOG true false Disable std log output

Example

[frontend]
TmpDir="/tmp"

Server

Server configuration options.

Name Type Env Values Default Description
Host string HOST hostname or IP Server listener host
Port uint PORT 1-65535 4040 Server listener port
AltPort uint ALT_PORT 1-65535 8080 Server alternate port
TLS bool TLS true=on, false=off true Enable TLS
CertDir string CERT_DIR /storage/certs Certificate directory
Cert string CERT_FILE cert.pem Pem encoded certificate
Pass string CERT_PASS Certificate password
Acme bool ACME true=on, false=off false Enable ACME certificates
AcmeDirectory string ACME_DIRECTORY ACME directory endpoint
Contact string CONTACT Server contact name
TrustProxy string TRUST_PROXY “X-Forwarded-For” ”” Trust proxy header
ProxyProtocol bool PROXY_PROTOCOL true,false false Enable proxy protocol v1/v2

If you enable ProxyProtocol you should not use TrustProxy headers.

Example

[frontend.Server]
Host="frontend.server.int"
Port=8080
TLS=false
TrustProxy="X-Client-IP"

Backend

Backend service url for the message bus.

Name Type Env Values Default Description
Url string BACKEND_URL url nats://127.0.0.1:4222 Backend message bus url

Example

[frontend.Backend]
Url="nats://backend.server.int:4222"

Proxy

Proxy allows you to forward requests to other servers based on the request path.

Name Type Env Values Default Description
Admin string url Url to admin server
Api string url Url to api server

If you use another mount point on the admin server you must setup the same proxy path here. In the cradle-cms container we have the admin server behind the frontend server using proxy path forwarding. We also make use of TrustProxy="X-Forwarded-For" on the admin server.

Example

[frontend.Proxy]
admin="http://127.0.0.1:8888/admin"
api="http://127.0.0.1:8888/api"

Site Session

Session cookie configuration for site sessions. Mainly used for eCommerce customer login sessions.

Name Type Env Values Default Description
Key string SITE_SESSION_KEY base64 RAW Session cookie hmac key
Secret string SITE_SESSION_SECRET base64 RAW Cookie encryption secret
IdleTime uint SITE_SESSION_IDLETIME seconds 300 Session idle timeout
LifeTime uint SITE_SESSION_LIFETIME seconds 600 Session lifetime
Secure bool SITE_SESSION_SECURE true Secure session only (tls)
HttpOnly bool SITE_SESSION_HTTP_ONLY true Http only

If you allow http access to you site you must set Secure to false or the cookie won’t be sent by the browser.

Example

[frontend.SiteSession]
Key="YSBsb25nIHJhbmRvbSBzdHJpbmcgb2YgY2hhcmFjdGVycwo"
Secret="c29tZXRoaW5nIHJhbmRvbSB1c2VkIGZvciBjb29raWUgZW5jcnlwdGlvbgo"
Idletime=300
Lifetime=600
Httponly=true
Secure=true

Cart Session

Session cookie configuration for eCommerce cart sessions.

Name Type Env Values Default Description
Key string CART_SESSION_KEY base64 RAW Session cookie hmac key
Secret string CART_SESSION_SECRET base64 RAW Cookie encryption secret
IdleTime uint CART_SESSION_IDLETIME seconds 300 Session idle timeout
LifeTime uint CART_SESSION_LIFETIME seconds 600 Session lifetime
Secure bool CART_SESSION_SECURE true Secure session only (tls)
HttpOnly bool CART_SESSION_HTTP_ONLY true Http only

If you allow http access to you site you must set Secure to false or the cookie won’t be sent by the browser.

Example

[frontend.CartSession]
Key="YSBsb25nIHJhbmRvbSBzdHJpbmcgb2YgY2hhcmFjdGVycwo"
Secret="c29tZXRoaW5nIHJhbmRvbSB1c2VkIGZvciBjb29raWUgZW5jcnlwdGlvbgo"
Idletime=600
Lifetime=86400
Httponly=true
Secure=true

Storage

Cradle currently supports FileSystem, S3 and NATS Object storage for files.

Storage configuration.

Name Type Env Values Default Description
ReadOnly bool READ_ONLY false Read only storage mode

Normally you have the same storage configuration on frontend and admin. However it can be set differently if you want to use other credentials to access your s3 storage.

S3

S3 based storage configuration.

Name Type Env Values Default Description
Endpoint string S3_ENDPPOINT S3 server endpoint url
Region string S3_REGION “us-east-1” S3 region
AccessKey string S3_ACCESS_KEY S3 server access key
SecretKey string S3_SECRET_KEY S3 server secret key

Example

[frontend.Storage.S3]
Endpoint="https://s3.amazonaws.com"
Region="us-east-2"
AccessKey="AKIAIOSFODNN7EXAMPLE"
SecretKey="wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY"

Object

NATS Object storage configuration.

Name Type Env Values Default Description
Endpoint string OBJECT_STORAGE Nats server endpoint

Example

[frontend.Storage.Object]
Endpoint="nats://127.0.0.1:4222"

Buckets

Bucket configuration for the storage.

Name Type Env Values Default Description
ThemeFiles string BUCKET_THEME_FILES “theme” Theme files
MediaFiles string BUCKET_MEDIA_FILES “media” Media files
CacheFiles string BUCKET_CACHE_FILES “cache” Cache files

When using FileSystem the buckets are mapped to directories.

Example

[frontend.Storage.Buckets]
ThemeFiles="theme"
MediaFiles="media"
CacheFiles="cache"

FileSystem

Filesystem storage configuration.

Name Type Env Values Default Description
Base string FILESYSTEM_BASE ”/storage” Filesystem base path

Example

[frontend.Storage.FileSystem]
Base="/storage"