Skip to Content

āš™ļø Configuration

HippoX can be configured through multiple methods: environment variables, TOML files, JSON files, or programmatically via API. Configuration is loaded in priority order, with programmatic overrides taking highest precedence.

šŸ”§

Configuration Priority: Programmatic Parameters greater than JSON String greater than JSON File greater than TOML File greater than Environment Variables greater than Defaults


🌐 Environment Variables

Set environment variables before starting your application. This is the simplest way to get started.

Basic Settings

VariableDescriptionDefault
HIPPOX_LANGLanguage setting (en or zh)en

SMTP Email Settings

VariableDescription
HIPPOX_SMTP_HOSTSMTP server hostname (e.g., smtp.gmail.com)
HIPPOX_SMTP_PORTSMTP server port (587 for TLS, 465 for SSL)
HIPPOX_SMTP_USERNAMESMTP authentication username
HIPPOX_SMTP_PASSWORDSMTP authentication password
HIPPOX_SMTP_FROMDefault sender email address

Messaging Platform Settings

VariableDescription
HIPPOX_TELEGRAM_BOT_TOKENTelegram bot token
HIPPOX_DINGDING_ACCESS_TOKENDingTalk robot access token
HIPPOX_FEISHU_WEBHOOKFeishu bot webhook URL
HIPPOX_WECOM_WEBHOOKWeCom robot webhook URL

FTP Settings

VariableDescriptionDefault
HIPPOX_FTP_HOSTFTP server hostname(empty)
HIPPOX_FTP_PORTFTP server port21
HIPPOX_FTP_USERNAMEFTP usernameanonymous
HIPPOX_FTP_PASSWORDFTP password(empty)
HIPPOX_FTP_REMOTE_DIRDefault remote directory/
HIPPOX_FTP_TIMEOUTConnection timeout in seconds30
HIPPOX_FTP_MODETransfer mode (binary or ascii)binary

TCP Settings

VariableDescriptionDefault
HIPPOX_TCP_HOSTDefault TCP host127.0.0.1
HIPPOX_TCP_PORTDefault TCP port8888
HIPPOX_TCP_TIMEOUTTimeout in seconds30
HIPPOX_TCP_ENCODINGEncoding (utf8, hex, base64)utf8

UDP Settings

VariableDescriptionDefault
HIPPOX_UDP_HOSTDefault UDP host127.0.0.1
HIPPOX_UDP_PORTDefault UDP port9999
HIPPOX_UDP_TIMEOUTTimeout in seconds30
HIPPOX_UDP_ENCODINGEncoding (utf8, hex, base64)utf8
HIPPOX_UDP_BROADCASTEnable broadcastfalse

PostgreSQL Settings

VariableDescription
HIPPOX_PG_HOSTPostgreSQL server hostname
HIPPOX_PG_PORTPostgreSQL port (default 5432)
HIPPOX_PG_DATABASEDatabase name
HIPPOX_PG_USERNAMEDatabase username
HIPPOX_PG_PASSWORDDatabase password
HIPPOX_PG_POOL_SIZEConnection pool size (default 10)
HIPPOX_PG_TIMEOUTQuery timeout in seconds (default 30)

MySQL Settings

VariableDescription
HIPPOX_MYSQL_HOSTMySQL server hostname
HIPPOX_MYSQL_PORTMySQL port (default 3306)
HIPPOX_MYSQL_DATABASEDatabase name
HIPPOX_MYSQL_USERNAMEDatabase username
HIPPOX_MYSQL_PASSWORDDatabase password
HIPPOX_MYSQL_POOL_SIZEConnection pool size (default 10)
HIPPOX_MYSQL_TIMEOUTQuery timeout in seconds (default 30)

Redis Settings

VariableDescription
HIPPOX_REDIS_HOSTRedis server hostname
HIPPOX_REDIS_PORTRedis port (default 6379)
HIPPOX_REDIS_PASSWORDRedis password
HIPPOX_REDIS_DBDatabase number (default 0)
HIPPOX_REDIS_POOL_SIZEConnection pool size (default 10)
HIPPOX_REDIS_TIMEOUTOperation timeout in seconds (default 30)

SQLite Settings

VariableDescription
HIPPOX_SQLITE_PATHPath to SQLite database file
HIPPOX_SQLITE_POOL_SIZEConnection pool size (default 5)
HIPPOX_SQLITE_TIMEOUTQuery timeout in seconds (default 30)

GitHub Settings

VariableDescriptionDefault
HIPPOX_GITHUB_TOKENGitHub Personal Access Token(empty)
HIPPOX_GITHUB_API_URLGitHub API URLhttps://api.github.comĀ 
HIPPOX_GITHUB_TIMEOUTAPI timeout in seconds30

Docker Settings

VariableDescriptionDefault
HIPPOX_DOCKER_HOSTDocker daemon hostunix:///var/run/docker.sock
HIPPOX_DOCKER_API_VERSIONDocker API version(empty)
HIPPOX_DOCKER_TIMEOUTConnection timeout in seconds30
HIPPOX_DOCKER_TLS_VERIFYEnable TLS verificationfalse
HIPPOX_DOCKER_CERT_PATHPath to TLS certificates(empty)

Kubernetes Settings

VariableDescriptionDefault
HIPPOX_K8S_KUBECONFIGPath to kubeconfig file(empty)
HIPPOX_K8S_CONTEXTKubernetes context name(empty)
HIPPOX_K8S_NAMESPACEDefault namespacedefault
HIPPOX_K8S_API_SERVERAPI server URL(empty)
HIPPOX_K8S_API_TOKENAPI bearer token(empty)
HIPPOX_K8S_TIMEOUTAPI timeout in seconds30
HIPPOX_K8S_INSECURESkip TLS verificationfalse
HIPPOX_K8S_CA_CERTCA certificate path(empty)
HIPPOX_K8S_CLIENT_CERTClient certificate path(empty)
HIPPOX_K8S_CLIENT_KEYClient key path(empty)

Example .env File

Here is an example .env file for reference:

Start of .env file content:

OPENAI_API_KEY=sk-your-key-here

HIPPOX_SMTP_HOST=smtp.gmail.com HIPPOX_SMTP_PORT=587 HIPPOX_SMTP_USERNAME=your-email@gmail.com HIPPOX_SMTP_PASSWORD=your-app-password HIPPOX_SMTP_FROM=noreply@yourdomain.com

HIPPOX_GITHUB_TOKEN=ghp_your_token_here

HIPPOX_PG_HOST=localhost HIPPOX_PG_PORT=5432 HIPPOX_PG_DATABASE=myapp HIPPOX_PG_USERNAME=postgres HIPPOX_PG_PASSWORD=secret

HIPPOX_DOCKER_HOST=unix:///var/run/docker.sock

End of .env file content.


šŸ“„ Configuration Files

TOML File

Create a config.toml file with the following content:

Start of config.toml:

lang = ā€œenā€

[smtp] host = ā€œsmtp.gmail.comā€ port = 587 username = ā€œyour-email@gmail.comā€ password = ā€œyour-app-passwordā€ from = ā€œnoreply@yourdomain.comā€

[github] token = ā€œghp_your_token_hereā€ api_url = ā€œhttps://api.github.comĀ ā€ timeout = 30

[postgresql] host = ā€œlocalhostā€ port = 5432 database = ā€œmyappā€ username = ā€œpostgresā€ password = ā€œsecretā€ pool_size = 10 timeout = 30

[docker] host = ā€œunix:///var/run/docker.sockā€ timeout = 30

[k8s] kubeconfig = ā€œ/path/to/kubeconfigā€ namespace = ā€œdefaultā€ timeout = 30

End of config.toml.

Load the TOML file using ConfigInitMethod::TomlFile with the file path.

JSON File

Create a config.json file with the following content:

Start of config.json:

( ā€œlangā€: ā€œenā€, ā€œsmtp_hostā€: ā€œsmtp.gmail.comā€, ā€œsmtp_portā€: 587, ā€œsmtp_usernameā€: ā€œyour-email@gmail.comā€, ā€œsmtp_passwordā€: ā€œyour-app-passwordā€, ā€œsmtp_fromā€: ā€œnoreply@yourdomain.comā€, ā€œgithub_tokenā€: ā€œghp_your_token_hereā€, ā€œpg_hostā€: ā€œlocalhostā€, ā€œpg_portā€: 5432, ā€œpg_databaseā€: ā€œmyappā€, ā€œpg_usernameā€: ā€œpostgresā€, ā€œpg_passwordā€: ā€œsecretā€ )

End of config.json.

Load the JSON file using ConfigInitMethod::JsonFile with the file path.


šŸ’» Programmatic Configuration

Via JSON String

Use ConfigInitMethod::ParamsJsonStr with a JSON string.

Example JSON string content:

( ā€œlangā€: ā€œzhā€, ā€œsmtp_hostā€: ā€œsmtp.qq.comā€, ā€œsmtp_portā€: 587, ā€œtelegram_bot_tokenā€: ā€œ123456:ABC-DEFā€ )

Via Individual Parameters

After initializing HippoX, you can update configuration programmatically.

Call hippox.update_config with a closure that modifies the config.

Example:

hippox.update_config with a closure that sets smtp_host, smtp_username, smtp_password, and telegram_bot_token.


šŸ” Checking Configuration Status

HippoX provides helper methods to check if specific integrations are configured:

MethodReturns true when…
is_smtp_configuredSMTP host, username, password, and from address are set
is_telegram_configuredTelegram bot token is set
is_dingtalk_configuredDingTalk access token is set
is_feishu_configuredFeishu webhook URL is set
is_wecom_configuredWeCom webhook URL is set
is_ftp_configuredFTP host is set
is_postgresql_configuredPostgreSQL host and database are set
is_mysql_configuredMySQL host and database are set
is_redis_configuredRedis host is set
is_sqlite_configuredSQLite path is set
is_docker_configuredDocker host is set
is_k8s_configuredKubeconfig or API server is set
is_github_configuredGitHub token is set

Example usage:

Get config by calling get_config.

Then check each configuration using the methods above.

For example, if config.is_smtp_configured returns true, then email skills are available.

If config.is_telegram_configured returns true, then Telegram notifications are ready.


šŸ“ Getting Current Configuration

Get the current configuration by calling get_config.

Then you can read fields like config.lang, config.smtp_host, config.docker_host.

šŸ’”

Security Note: Never commit sensitive configuration (API keys, passwords, tokens) to version control. Use environment variables or secret management tools for production deployments.

Last updated on