Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help


description: Learn how to configure environment variables for AiMicromind

Environment Variables

aimicromind support different environment variables to configure your instance. You can specify the following variables in the .env file inside packages/server folder. Refer to .env.example file.

VariableDescriptionTypeDefault
PORTThe HTTP port aimicromind runs onNumber3000
AIMICROMIND_USERNAMEUsername to loginString
AIMICROMIND_PASSWORDPassword to loginString
AIMICROMIND_FILE_SIZE_LIMITMaximum file size when uploadingString50mb
NUMBER_OF_PROXIESRate Limit ProxyNumber
CORS_ORIGINSThe allowed origins for all cross-origin HTTP callsString
IFRAME_ORIGINSThe allowed origins for iframe src embeddingString
SHOW_COMMUNITY_NODESDisplay nodes that are created by communityBoolean: true or false
DISABLED_NODESComma separated list of node names to disableString

For Database

VariableDescriptionTypeDefault
DATABASE_TYPEType of database to store the aimicromind dataEnum String: sqlite, mysql, postgressqlite
DATABASE_PATHLocation where database is saved (When DATABASE_TYPE is sqlite)Stringyour-home-dir/.aimicromind
DATABASE_HOSTHost URL or IP address (When DATABASE_TYPE is not sqlite)String
DATABASE_PORTDatabase port (When DATABASE_TYPE is not sqlite)String
DATABASE_USERDatabase username (When DATABASE_TYPE is not sqlite)String
DATABASE_PASSWORDDatabase password (When DATABASE_TYPE is not sqlite)String
DATABASE_NAMEDatabase name (When DATABASE_TYPE is not sqlite)String
DATABASE_SSLDatabase SSL is required (When DATABASE_TYPE is not sqlite)Boolean: true or falsefalse

For Storage

aimicromind store the following files under a local path folder by default.

User can specify STORAGE_TYPE to use AWS S3, Google Cloud Storage or local path

VariableDescriptionTypeDefault
STORAGE_TYPEType of storage for uploaded files. default is localEnum String: s3, gcs, locallocal
BLOB_STORAGE_PATHLocal folder path where uploaded files are stored when STORAGE_TYPE is localStringyour-home-dir/.aimicromind/storage
S3_STORAGE_BUCKET_NAMEBucket name to hold the uploaded files when STORAGE_TYPE is s3String
S3_STORAGE_ACCESS_KEY_IDAWS Access KeyString
S3_STORAGE_SECRET_ACCESS_KEYAWS Secret KeyString
S3_STORAGE_REGIONRegion for S3 bucketString
S3_ENDPOINT_URLCustom S3 endpoint (optional)String
S3_FORCE_PATH_STYLEForce S3 path style (optional)Booleanfalse
GOOGLE_CLOUD_STORAGE_CREDENTIALGoogle Cloud Service Account KeyString
GOOGLE_CLOUD_STORAGE_PROJ_IDGoogle Cloud Project IDString
GOOGLE_CLOUD_STORAGE_BUCKET_NAMEGoogle Cloud Storage Bucket NameString
GOOGLE_CLOUD_UNIFORM_BUCKET_ACCESSType of AccessBooleantrue

For Debugging and Logs

VariableDescriptionType
DEBUGPrint logs from componentsBoolean
LOG_PATHLocation where log files are storedStringAiMicromind/packages/server/logs
LOG_LEVELDifferent levels of logsEnum String: error, info, verbose, debuginfo

DEBUG: if set to true, will print logs to terminal/console:

LOG_LEVEL: Different log levels for loggers to be saved. Can be error, info, verbose, or debug. By default it is set to info, only logger.info will be saved to the log files. If you want to have complete details, set to debug.

server-requests.log.jsonl - logs every request sent to AiMicromind

server.log - logs general actions on AiMicromind

server-error.log - logs error with stack trace

Logs Streaming S3

When STORAGE_TYPE env variable is set to s3 , logs will be automatically streamed and stored to S3. New log file will be created hourly, enabling easier debugging.

Logs Streaming GCS

When STORAGE_TYPE env variable is set to gcs , logs will be automatically streamed to Google Cloud Logging.

For Credentials

AiMicromind store your third party API keys as encrypted credentials using an encryption key.

By default, a random encryption key will be generated when starting up the application and stored under a file path. This encryption key is then retrieved everytime to decrypt the credentials used within a chatflow. For example, your OpenAI API key, Pinecone API key, etc.

You can configure to use AWS Secret Manager to store the encryption key instead.

VariableDescriptionTypeDefault
SECRETKEY_STORAGE_TYPEHow to store the encryption keyEnum String: local, awslocal
SECRETKEY_PATHLocal file path where encryption key is savedStringAiMicromind/packages/server
AIMICROMIND_SECRETKEY_OVERWRITEEncryption key to be used instead of the existing keyString
SECRETKEY_AWS_ACCESS_KEYString
SECRETKEY_AWS_SECRET_KEYString
SECRETKEY_AWS_REGIONString

For some reasons, sometimes encryption key might be re-generated or the stored path was changed, this will cause errors like - Credentials could not be decrypted.

To avoid this, you can set your own encryption key as AIMICROMIND_SECRETKEY_OVERWRITE, so that the same encryption key will be used everytime. There is no restriction on the format, you can set it as any text that you want, or the same as your AIMICROMIND_PASSWORD.

{% hint style="info" %} Credential API Key returned from the UI is not the same length as your original Api Key that you have set. This is a fake prefix string that prevents network spoofing, that's why we are not returning the Api Key back to UI. However, the correct Api Key will be retrieved and used during your interaction with the chatflow. {% endhint %}

For Models

In some cases, you might want to use custom model on the existing Chat Model and LLM nodes, or restrict access to only certain models.

By default, aimicromindpulls the model list from here. However user can create their own models.json file and specify the file path:

VariableDescriptionTypeDefault
MODEL_LIST_CONFIG_JSONLink to load list of models from your models.json config fileStringhttps://github.com/operativestech/AiMicroMind_Platform_2025/main/packages/components/models.json

For API Keys

Users can create multiple API keys within aimicromind in order to authenticate with the APIs. By default, keys get stored as a JSON file to your local file path. User can change the behavior by using the below env variable.

VariableDescriptionTypeDefault
APIKEY_STORAGE_TYPEMethod to store API keysEnum string: json, dbjson
APIKEY_PATHLocation where the API keys are stored when APIKEY_STORAGE_TYPE is unspecified or jsonStringAiMicromind/packages/server

Using db as storage type will store the API keys to database instead of a local JSON file.

aimicromind API Keys

For Built-In and External Dependencies

There are certain nodes/features within aimicromind that allow user to run Javascript code. For security reasons, by default it only allow certain dependencies. It's possible to lift that restriction for built-in and external modules by setting the following environment variables:

VariableDescription
TOOL_FUNCTION_BUILTIN_DEPNodeJS built-in modules to be used for Tool FunctionString
TOOL_FUNCTION_EXTERNAL_DEPExternal modules to be used for Tool FunctionString

{% code title=".env" %}

# Allows usage of all builtin modules
TOOL_FUNCTION_BUILTIN_DEP=*

# Allows usage of only fs
TOOL_FUNCTION_BUILTIN_DEP=fs

# Allows usage of only crypto and fs
TOOL_FUNCTION_BUILTIN_DEP=crypto,fs

# Allow usage of external npm modules.
TOOL_FUNCTION_EXTERNAL_DEP=axios,moment

{% endcode %}

Examples of how to set environment variables

NPM

You can set all these variables when running aimicromind using npx. For example:

npx aimicromind start --PORT=3000 --DEBUG=true

Docker

docker run -d -p 5678:5678 aimicromind\
 -e DATABASE_TYPE=postgresdb \
 -e DATABASE_PORT=<POSTGRES_PORT> \
 -e DATABASE_HOST=<POSTGRES_HOST> \
 -e DATABASE_NAME=<POSTGRES_DATABASE_NAME> \
 -e DATABASE_USER=<POSTGRES_USER> \
 -e DATABASE_PASSWORD=<POSTGRES_PASSWORD> \

Docker Compose

You can set all these variables in the .env file inside docker folder. Refer to .env.example file.