-
-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Ryu Juheon edited this page Dec 13, 2025
·
2 revisions
This document provides a comprehensive guide to configuring Sunflower, including all available configuration options, their defaults, and usage examples.
Sunflower supports three methods of configuration, listed in order of precedence:
- JSON Configuration File
- Command Line Arguments
- Environment Variables
You can specify a JSON configuration file using the --config argument, or by setting the SUNFLOWER_USE_ENV environment variable to true and then using the SUNFLOWER_CONFIG environment variable.
{
"GALLERYINFO_DB_URL": "postgresql+asyncpg://postgres_user:sunflowerpasswd@localhost/sunflower_db",
"INFO_DB_URL": "mongodb://sunflower:sunflowerpasswd@localhost",
"HOST": "0.0.0.0",
"PORT": 22222,
"DEBUG": false,
"PRODUCTION": true,
"MIRRORING_DELAY": 3600,
"INDEX_FILES": ["index-japanese.nozomi"]
}All configuration options can be set via command line arguments.
python -m sunflower --helpEnvironment variables use the SUNFLOWER_ prefix and configuration values are loaded as environment variables only when SUNFLOWER_USE_ENV is set to true.
Note: List values in environment variables should be JSON-formatted strings.
export SUNFLOWER_USE_ENV=true
export SUNFLOWER_HOST=0.0.0.0
export SUNFLOWER_PORT=22222
export SUNFLOWER_GALLERYINFO_DB_URL="postgresql+asyncpg://user:pass@localhost/db"| Option | Type | Default | Description |
|---|---|---|---|
HOST |
string | 127.0.0.1 |
The hostname to listen on |
PORT |
integer | 22222 |
The port of the webserver |
DEBUG |
boolean | false |
Enable debug mode |
ACCESS_LOG |
boolean | true |
Enable access logging (use --access-log to disable) |
FORWARDED_SECRET |
string | "" |
Secret for validating forwarded headers |
| Option | Type | Default | Description |
|---|---|---|---|
PRODUCTION |
boolean | false |
Run the server in production mode |
CONFIG |
string | "" |
Path to the JSON configuration file |
SENTRY_DSN |
string | "" |
Sentry DSN for error tracking |
USE_ENV |
boolean | false |
Use environment variables for configuration |
| Option | Type | Default | Description |
|---|---|---|---|
GALLERYINFO_DB_URL |
string | "" |
database URL for gallery information (Recommend PostgresSQL) |
INFO_DB_URL |
string | "" |
MongoDB URL for additional information |
USE_ATLAS_SEARCH |
boolean | false |
Use MongoDB Atlas Search features |
MONGODB_SEARCH_INDEX_ANALYZER |
string | lucene.korean |
The analyzer to use for mongodb search index |
MONGODB_SEARCH_INDEX_SEARCH_ANALYZER |
string | lucene.korean |
The search analyzer to use for mongodb search index |
| Option | Type | Default | Description |
|---|---|---|---|
INDEX_FILES |
list[string] | ["index-english.nozomi"] |
Index files to use for mirroring |
MIRRORING_DELAY |
integer | 3600 |
Delay between mirroring tasks (seconds) |
MIRRORING_REMOTE_CONCURRENT_SIZE |
integer | 50 |
Concurrent requests to remote server |
MIRRORING_LOCAL_CONCURRENT_SIZE |
integer | 25 |
Concurrent requests to local database |
DISABLE_MIRRORING |
boolean | false |
Disable the mirroring task |
[
"index-albanian.nozomi",
"index-all.nozomi",
"index-arabic.nozomi",
"index-bulgarian.nozomi",
"index-burmese.nozomi",
"index-catalan.nozomi",
"index-cebuano.nozomi",
"index-chinese.nozomi",
"index-czech.nozomi",
"index-danish.nozomi",
"index-dutch.nozomi",
"index-english.nozomi",
"index-esperanto.nozomi",
"index-estonian.nozomi",
"index-finnish.nozomi",
"index-french.nozomi",
"index-german.nozomi",
"index-greek.nozomi",
"index-hebrew.nozomi",
"index-hindi.nozomi",
"index-hungarian.nozomi",
"index-icelandic.nozomi",
"index-indonesian.nozomi",
"index-italian.nozomi",
"index-japanese.nozomi",
"index-javanese.nozomi",
"index-korean.nozomi",
"index-latin.nozomi",
"index-mongolian.nozomi",
"index-norwegian.nozomi",
"index-persian.nozomi",
"index-polish.nozomi",
"index-portuguese.nozomi",
"index-romanian.nozomi",
"index-russian.nozomi",
"index-serbian.nozomi",
"index-slovak.nozomi",
"index-spanish.nozomi",
"index-swedish.nozomi",
"index-tagalog.nozomi",
"index-thai.nozomi",
"index-turkish.nozomi",
"index-ukrainian.nozomi",
"index-vietnamese.nozomi"
]| Option | Type | Default | Description |
|---|---|---|---|
INTEGRITY_PARTIAL_CHECK_DELAY |
integer | 21600 |
Delay between partial integrity checks (seconds) |
INTEGRITY_FULL_CHECK_DELAY |
integer | 432000 |
Delay between full integrity checks (seconds) |
INTEGRITY_PARTIAL_CHECK_RANGE_SIZE |
integer | 100 |
Range size for integrity checks |
RUN_AS_ONCE |
boolean | false |
Run the mirroring and integrity tasks only once |
DISABLE_INTEGRITY_CHECK |
boolean | false |
Disable the integrity check task |
DISABLE_INTEGRITY_PARTIAL_CHECK |
boolean | false |
Disable the integrity partial check task |
DISABLE_INTEGRITY_FULL_CHECK |
boolean | false |
Disable the integrity full check task |