Skip to main content

Environment Variables Overview

To configure FaynoSync, you need to set the following environment variables. These settings ensure that your application communicates correctly with storage services, databases, and APIs.


📋 Quick Reference

CategoryVariables
CoreAPI_URL, STORAGE_DRIVER, PORT
StorageS3_*, GCS_*, MINIO_*
DatabaseMONGODB_URL, MONGODB_URL_TESTS
SecurityAPI_KEY, JWT_SECRET
FeaturesPERFORMANCE_MODE, ENABLE_TELEMETRY
RedisREDIS_*
SlackSLACK_*

🔧 Required Environment Variables

Core Configuration

API_URL

Public URL to this API.

Example: API_URL=https://faynosync.example.com

ENABLE_PRIVATE_APP_DOWNLOADING

If enabled, then apps located in private S3 can be downloaded using the public API; if disabled, then download links require authentication.

Example: ENABLE_PRIVATE_APP_DOWNLOADING=false

STORAGE_DRIVER

Specifies the storage driver to use.

Available options:

  • minio: For local development or private S3-compatible object storage.
  • aws: For using AWS S3 as your object storage solution.
  • digitalocean: For using DigitalOcean Spaces as your object storage solution.
  • gcp: For using Google Cloud Storage as your object storage solution.

Example: STORAGE_DRIVER=minio

DASHBOARD_URL

The URL of your dashboard. This is used for configuring CORS (Cross-Origin Resource Sharing) to allow requests to the auto updater service from your dashboard.

Example: DASHBOARD_URL=http://localhost:3000

PORT

The port on which the auto updater service will listen. By default, the service listens on port 9000.

Example: PORT=9000

Database Configuration

MONGODB_URL

The MongoDB connection string used by FaynoSync. This string contains information such as the host, database name, and authentication details.

Example: MONGODB_URL=mongodb://root:password@127.0.0.1/faynosync_db?authSource=admin

MONGODB_URL_TESTS

The MongoDB connection string used by FaynoSync for tests running. This string contains information such as the host, database name, and authentication details.

Example: MONGODB_URL_TESTS=mongodb://root:password@127.0.0.1/faynosync_db_tests?authSource=admin

Security Configuration

API_KEY

This key is used for authentication during sign-up and other API interactions.

Generate this key using openssl rand -base64 16.

Example: API_KEY=generated_api_key

JWT_SECRET

A secret key used for signing and verifying JWT (JSON Web Tokens) used by the application for secure communication.

Generate this key using openssl rand -base64 32.

Example: JWT_SECRET=your_jwt_secret

Performance & Features

PERFORMANCE_MODE

This setting enables performance optimizations within the application when set to true. Use this for high-load environments where efficiency is a priority.

Example: PERFORMANCE_MODE=true

ENABLE_TELEMETRY

This setting enables statistics when set to true.

Example: ENABLE_TELEMETRY=true

Redis Configuration

REDIS_HOST

The hostname or IP address of the Redis server. If not specified, it defaults to localhost.

Example: REDIS_HOST=your_redis_host

REDIS_PORT

The port number on which the Redis server is listening. The default value is 6379.

Example: REDIS_PORT=6379

REDIS_PASSWORD

The password for authenticating with the Redis server. Leave this empty if no password is set for your Redis instance.

Example: REDIS_PASSWORD=your_redis_password

REDIS_DB

Specifies which Redis database number to use. The default is 0.

Example: REDIS_DB=0

Slack Integration

SLACK_ENABLE

Specifies whether Slack integration is enabled. If SLACK_ENABLE=false, no messages will be sent to Slack. The default is false.

Example: SLACK_ENABLE=true

SLACK_BOT_TOKEN

The authentication token for the Slack bot used to access the API. It should be in the format xoxb-*.

Example: SLACK_BOT_TOKEN=xoxb-123456789012-1234567890123-abcdef123456

SLACK_CHANNEL

Specifies the name of the Slack channel where messages will be sent.

Example: SLACK_CHANNEL=test-channel


🗄️ Storage Configuration

MinIO (Local or Cloud S3-compatible Storage)

For local development or private S3-compatible object storage:

VariableDescriptionExample
STORAGE_DRIVERSet to minio for MinIO storage.STORAGE_DRIVER=minio
MINIO_SECURESpecifies whether to use secure connections (HTTPS) for MinIO. Set to false for local development.MINIO_SECURE=false
S3_ACCESS_KEYYour MinIO access key ID.S3_ACCESS_KEY=your_minio_access_key
S3_SECRET_KEYYour MinIO secret access key.S3_SECRET_KEY=your_minio_secret_key
S3_BUCKET_NAME_PRIVATEThe name of your MinIO bucket for private storage.S3_BUCKET_NAME_PRIVATE=cb-faynosync-s3
S3_BUCKET_NAMEThe name of your MinIO bucket for public storage.S3_BUCKET_NAME=cb-faynosync-s3-public
S3_ENDPOINT_PRIVATEThe MinIO endpoint URL.S3_ENDPOINT_PRIVATE=localhost:9010
S3_ENDPOINTThe public MinIO endpoint URL.S3_ENDPOINT=localhost:9010

AWS S3 (Amazon Simple Storage Service)

For using AWS S3 as your object storage solution:

VariableDescriptionExample
STORAGE_DRIVERSet to aws for AWS S3 storage.STORAGE_DRIVER=aws
S3_ACCESS_KEYYour AWS access key ID.S3_ACCESS_KEY=your_aws_access_key
S3_SECRET_KEYYour AWS secret access key.S3_SECRET_KEY=your_aws_secret_key
S3_REGIONThe AWS region in which your S3 bucket is located.S3_REGION=us-east-1
S3_BUCKET_NAME_PRIVATEThe name of your AWS S3 bucket for private storage.S3_BUCKET_NAME_PRIVATE=your-private-bucket
S3_BUCKET_NAMEThe name of your AWS S3 bucket for public storage.S3_BUCKET_NAME=your-public-bucket
S3_ENDPOINT_PRIVATEThe AWS S3 endpoint URL.S3_ENDPOINT_PRIVATE=https://your-bucket-name.s3.amazonaws.com
S3_ENDPOINTThe public AWS S3 endpoint URL.S3_ENDPOINT=https://your-public-bucket.s3.amazonaws.com

DigitalOcean Spaces (S3-compatible Storage from DigitalOcean)

For using DigitalOcean Spaces as your object storage solution:

VariableDescriptionExample
STORAGE_DRIVERSet to digitalocean for DigitalOcean Spaces storage.STORAGE_DRIVER=digitalocean
S3_ACCESS_KEYYour DigitalOcean Spaces access key.S3_ACCESS_KEY=DO00EXAMPLEKEY
S3_SECRET_KEYYour DigitalOcean Spaces secret key.S3_SECRET_KEY=EXAMPLE_SECRET_KEY
S3_REGIONThe DigitalOcean region where your Space is located.S3_REGION=nyc3
S3_BUCKET_NAME_PRIVATEThe name of your DigitalOcean Space for private storage.S3_BUCKET_NAME_PRIVATE=your-private-space
S3_BUCKET_NAMEThe name of your DigitalOcean Space for public storage.S3_BUCKET_NAME=your-public-space
S3_ENDPOINT_PRIVATEThe DigitalOcean Spaces endpoint URL.S3_ENDPOINT_PRIVATE=nyc3.digitaloceanspaces.com

Google Cloud Storage (GCP)

For using Google Cloud Storage as your object storage solution:

VariableDescriptionExample
STORAGE_DRIVERSet to gcp for Google Cloud Storage.STORAGE_DRIVER=gcp
GCS_CREDENTIALS_FILEPath to Google Cloud service account credentials JSON file.GCS_CREDENTIALS_FILE=/path/to/credentials.json
GCS_SERVICE_ACCOUNT_EMAILGCS service account email for presigned URL generation.GCS_SERVICE_ACCOUNT_EMAIL=your-service-account@project.iam.gserviceaccount.com
GCS_PRIVATE_KEYGCS private key for presigned URL generation.GCS_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIIEv...\n-----END PRIVATE KEY-----\n
S3_BUCKET_NAME_PRIVATEThe name of your GCS bucket for private storage.S3_BUCKET_NAME_PRIVATE=your-private-gcs-bucket
S3_BUCKET_NAMEThe name of your GCS bucket for public storage.S3_BUCKET_NAME=your-public-gcs-bucket

⚙️ Setting Up Environment Variables

You can set these environment variables in a .env file in the root directory of the application. Here's an example of what your .env file might look like:

# =============================================================================
# MINIO (local or cloud S3-compatible storage)
# =============================================================================
STORAGE_DRIVER=minio
MINIO_SECURE=false
S3_BUCKET_NAME_PRIVATE=cb-faynosync-s3
S3_ENDPOINT_PRIVATE=localhost:9010
S3_ACCESS_KEY=
S3_SECRET_KEY=
S3_BUCKET_NAME=cb-faynosync-s3-public
S3_ENDPOINT=localhost:9010

# =============================================================================
# AWS S3 (Amazon Simple Storage Service)
# =============================================================================
#STORAGE_DRIVER=aws
#S3_ACCESS_KEY=
#S3_SECRET_KEY=
#S3_REGION=
# S3_BUCKET_NAME_PRIVATE=
# S3_BUCKET_NAME=
#S3_ENDPOINT_PRIVATE=https://<bucket_name>.s3.amazonaws.com # for example in us-east-1
#S3_ENDPOINT=https://<bucket_name>.s3.amazonaws.com # for example in us-east-1

# =============================================================================
# DIGITALOCEAN SPACES (S3-compatible storage from DigitalOcean)
# =============================================================================
# STORAGE_DRIVER=digitalocean
# S3_ENDPOINT_PRIVATE=nyc3.digitaloceanspaces.com
# S3_REGION=nyc3
# S3_ACCESS_KEY=DO00EXAMPLEKEY
# S3_SECRET_KEY=EXAMPLE_SECRET_KEY
# S3_BUCKET_NAME_PRIVATE=
# S3_BUCKET_NAME=

# =============================================================================
# GOOGLE CLOUD STORAGE (GCP)
# =============================================================================
# STORAGE_DRIVER=gcp
# GCS_CREDENTIALS_FILE=/path/to/credentials.json
# GCS_SERVICE_ACCOUNT_EMAIL=your-service-account@project.iam.gserviceaccount.com
# GCS_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIIEv...\n-----END PRIVATE KEY-----\n
# S3_BUCKET_NAME_PRIVATE=
# S3_BUCKET_NAME=

# =============================================================================
# Other Configuration
# =============================================================================
DASHBOARD_URL=http://localhost:3000
PORT=9000
MONGODB_URL=mongodb://root:password@127.0.0.1/faynosync_db?authSource=admin
API_KEY=generated_api_key
API_URL=http://localhost:9000
ENABLE_PRIVATE_APP_DOWNLOADING=false
JWT_SECRET=your_jwt_secret
MONGODB_URL_TESTS=mongodb://root:password@127.0.0.1/faynosync_db_tests?authSource=admin
PERFORMANCE_MODE=true
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
SLACK_ENABLE=false
SLACK_BOT_TOKEN=xoxb-*
SLACK_CHANNEL=test-channel
ENABLE_TELEMETRY=true

For convenience, you can also use the .env.local file, which contains all the variables already filled in. Ensure that your environment variables are properly set before running the application to avoid misconfigurations.