Skip to main content

Configuration

All ToolBake configurations can be set through environment variables

Change Database Type

ToolBake supports multiple databases internally.

Currently supported databases:

  • sqlite
  • mysql

The database type is configured through the DB_TYPE environment variable. Different databases have different environment variable configurations, which will be explained separately below.

note

The default value of DB_TYPE is sqlite, so if you don't configure anything, ToolBake will use sqlite as the database.

sqlite

This is the default database used by ToolBake. If you don't configure anything, ToolBake will use sqlite as the database, and the database file will be stored in data/sqlite.db.

Environment VariableDescriptionDefault Value
DB_TYPEDatabase typesqlite
SQLLITE_PATHsqlite database file path, stored in data/sqlite.db by defaultdata/sqlite.db

mysql

Use mysql as the database by setting DB_TYPE=mysql, and you also need to set the following environment variables:

Environment VariableDescription
DB_TYPESet to mysql
MYSQL_HOSTmysql host
MYSQL_PORTmysql port
MYSQL_USERmysql user
MYSQL_PASSmysql password
MYSQL_DBmysql database

NoSQL Configuration

To manage user authentication tokens and various cache data, ToolBake uses a separate Key-Value NoSQL database to store this data.

ToolBake uses the KEY_VALUE_DB_TYPE environment variable to configure which NoSQL database to use.

note

Currently, ToolBake only supports using the embedded nutsdb as the default NoSQL database. In the future, it will support Redis and other databases.

nutsdb

The default value of KeyValueDBType is nutsdb, which uses nutsdb as the NoSQL database. The database files will be stored in data/nutsdb.

Environment VariableDescriptionDefault Value
KEY_VALUE_DB_TYPENoSQL database typenutsdb
NUTSDB_PATHnutsdb database folder path, stored in data/nutsdb directory by defaultdata/nutsdb

Authentication Token Expiration Time

ToolBake uses RefreshToken + AccessToken as the authentication method. You can configure the token expiration time through the REFRESH_TOKEN_TTL and ACCESS_TOKEN_TTL environment variables.

Environment VariableDescriptionDefault Value
REFRESH_TOKEN_TTLRefreshToken expiration time in seconds15778463
ACCESS_TOKEN_TTLAccessToken expiration time in seconds300

Configure JSON File Path

When ToolBake starts, it generates a configuration file config.json to store some randomly generated configuration information, such as the JWT secret for AccessToken.

This file is stored in data/config.json by default. You can also configure the storage path through the CONFIG_FILE_PATH environment variable.

Configure Log Output

ToolBake's server-side logs support two formats:

  • Plain text logs
  • JSON format logs

You can configure the log format through the LOG_FORMAT environment variable.

You can also configure the log level through the LOG_LEVEL environment variable.

Environment VariableDescriptionDefault Value
LOG_FORMATLog format, supports text and jsontext
LOG_LEVELLog level, supports debug info warn errorinfo

SSO Configuration

ToolBake supports multiple SSO Provider logins. You can configure the corresponding SSO Provider through the following environment variables.

Github SSO Configuration

Environment VariableDescription
SSO_GITHUB_CLIENT_IDGithub OAuth Client ID
SSO_GITHUB_CLIENT_SECRETGithub OAuth Client Secret
SSO_GITHUB_REDIRECT_URLGithub OAuth Redirect URL

Google SSO Configuration

Environment VariableDescription
SSO_GOOGLE_CLIENT_IDGoogle OAuth Client ID
SSO_GOOGLE_CLIENT_SECRETGoogle OAuth Client Secret
SSO_GOOGLE_REDIRECT_URLGoogle OAuth Redirect URL

Enable Password Login

ToolBake does not enable password login by default. You can enable password login by setting ENABLE_PASSWORD_LOGIN=true.

Environment VariableDescriptionDefault Value
ENABLE_PASSWORD_LOGINWhether to enable password login, supports true and falsefalse

Disable User Registration

User registration is enabled by default. You can disable user registration by setting ENABLE_USER_REGISTRATION=false.

Environment VariableDescriptionDefault Value
ENABLE_USER_REGISTRATIONWhether to enable user registration, supports true and falsetrue

WebAuthn (Passkey) Configuration

ToolBake also supports Passkey login using the WebAuthn protocol. If you want to enable Passkey login, you need to configure the following environment variables.

note

Due to the hard requirements of Passkey, enabling Passkey login requires that your website already supports HTTPS access. To enable Passkey login, please configure HTTPS access for your website first.

Environment VariableDescriptionSample
WEBAUTHN_RP_NAMEWebAuthn RP Name. When self-hosting, please use a unique name and do not use the default value to prevent conflicts with the official website's webauthn RP nameToolBake-localhost
WEBAUTHN_RP_IDWebAuthn RP ID, also a unique namelocalhost
WEBAUTHN_RP_ORIGINWebAuthn RP Origin, must be exactly the same as your website URLhttps://toolbake.com
WEBAUTHN_CHALLENGE_TTLWebAuthn Challenge expiration time in seconds300

Complete Environment Variable List

ENV_NAMEdefaultValuesupported value
FRONTEND_ASSET_PATH./frontend
HOST0.0.0.0:8080
DB_TYPEsqlitesqlite, mysql
DUCKDB_PATHdata/duckdb.db
SQLLITE_PATHdata/sqlite.db
KEY_VALUE_DB_TYPEnutsdbnutsdb, redis, rds
BADGER_PATHdata/badger
NUTSDB_PATHdata/nutsdb
REFRESH_TOKEN_TTL15778463
ACCESS_TOKEN_TTL300
CONFIG_FILE_PATHdata/config.json
LOG_FORMATtexttext, json
LOG_LEVELinfodebug, info, warn, error
SSO_GITHUB_CLIENT_ID
SSO_GITHUB_CLIENT_SECRET
SSO_GITHUB_REDIRECT_URL
SSO_GOOGLE_CLIENT_ID
SSO_GOOGLE_CLIENT_SECRET
SSO_GOOGLE_REDIRECT_URL
ENABLE_PASSWORD_LOGINfalse
ENABLE_USER_REGISTRATIONtrue
WEBAUTHN_RP_NAMEToolBake-localhost
WEBAUTHN_RP_IDlocalhost
WEBAUTHN_RP_ORIGINhttp://localhost:8080
WEBAUTHN_CHALLENGE_TTL300
MYSQL_HOST
MYSQL_PORT
MYSQL_USER
MYSQL_PASS
MYSQL_DB