amaGama has some settings to allow tuning its behaviour. Below you can see a detailed description for each setting and its default values.
amaGama settings are stored in amagama/settings.py.
Alternatively you can specify settings in a separate file to override the
built-in settings in amagama/settings.py. This avoids having to edit a
file that is tracked in the version control system. To use these settings, set
the environment variable AMAGAMA_CONFIG to the full path of your file. This
should be used as overrides to the default settings, so whatever is specified
in this file will take precedence over the file settings.py.
Settings to define amaGama server behavior.
DEBUGDefault: False
Indicates if debug mode is enabled.
SECRET_KEYDefault: foobar
The secret key to use for keeping the sessions secure. Choose a long random string and keep this secret. amaGama logs a warning at startup while it is still the default.
ENABLE_WEB_UIDefault: False
Enables the web interface: a page for looking up translations, in the
language of its ?lang= argument or else the browser’s, as the
sources list is.
The page is translated in amagama/po/web/: one <lang>.po
per language, from the template web.pot, as block titles are. After changing the page’s text, regenerate the
template; the tests fail while it’s out of date:
$ amagama-manage web_pot
ENABLE_DATA_ALTERING_APIDefault: False
Enables the operations of the amaGama API that alters data. If set to
False, the system can be considered read-only.
This doesn’t affect to the part of the API that is used to perform queries that don’t alter the data. For example retrieving translations is always enabled.
Settings used for connecting to the amaGama database.
DB_HOSTDefault: "localhost"
Hostname of the server where the amaGama database is located.
DB_NAMEDefault: "amagama"
amaGama database name.
DB_PASSWORDDefault: ""
Password for the amaGama database user.
DB_PORTDefault: "5432"
Port number where the database server holding the amaGama database is listening.
DB_USERDefault: "postgres"
User name for connecting to the amaGama database.
Settings for the database pool.
DB_MAX_CONNECTIONSDefault: 20
Maximum number of connections in the database pool.
DB_MIN_CONNECTIONSDefault: 2
Minimum number of connections in the database pool.
amaGama uses Flask-Caching to
cache source-id lookups. Any of Flask-Caching’s CACHE_* settings can be
set here to configure it.
CACHE_TYPEDefault: SimpleCache
The Flask-Caching backend to use. The default is a simple per-process
in-memory cache. For a deployment running multiple worker processes, a
shared backend such as RedisCache (with CACHE_REDIS_URL) gives a
better cache hit rate.
Settings for fetching translations to import, see Translation sources.
UPDATER_CACHE_DIRDefault: ~/.cache/amagama-updater
Where fetched translations are kept, one directory per block. Each
translation file is kept zstd-compressed (.zst, about a fifth of its size)
and decompressed only while it is imported; templates are kept as they are.
.repos holds the git repositories the blocks fetch from, which the
commands writing blocks also read when the cache exists.
UPDATER_EXCLUDE_TAGSDefault: []
Blocks with any of these tags are left out of fetching and
building, such as ["trial"].
UPDATER_FIRST_FETCHESDefault: 100
How many blocks one run of fetch_sources or
update fetches for the first time, picked at random,
so an empty cache fills over several days instead of in one burst on every
source. A block whose first fetch failed is retried without counting.
None is no limit.
UPDATER_SOURCESDefault: None
The sources file to use instead of amagama/updater/sources.toml.
UPDATER_TAGSDefault: None
The tags of the blocks this server fetches and builds:
blocks with any of them, such as ["core", "platform"]. None is every
block.
UPDATER_WORKERSDefault: 4
How many files update imports at once, each in its own process with its own database connection.
Settings for Levenshtein algorithm. See Levenshtein distance for more information.
MAX_CANDIDATESDefault: 5
The maximum number of results returned. This can be overridden by providing another value using a query string.
MAX_LENGTHDefault: 2000
Maximum length of source strings. If a string is longer, then it won’t be matched or returned in the results. This setting is also used during import to filter out source strings. It is therefore not very meaningful to increase this after importing translations. Note that a value above 3000 characters (or even less for CJK languages) might give problems, and is less likely to be useful to users. It is after all about a whole page of text in one string!
MIN_SIMILARITYDefault: 70
The minimum similarity between the query string and the candidate strings.
This can be overridden by providing a higher value using a query string, but the setting is considered a lower limit. This setting is used during database deployment to determine optimal settings for the database indexes. It will be detrimental to performance to lower this setting after deploying the database, up to the point of possibly enabling denial of service attacks.