Configuration File
Config `confg.toml` file for the Mega project.
Path
- Default: automatically load
config.toml
in current directory. - Specify manually: use
--config "/path/to/config.toml"
Enhance
- You can use environment variables starting with
MEGA_
to override the configuration inconfig.toml
.- like
MEGA_BASE_DIR
to overridebase_dir
. // withenv::set_var()
- use separator
__
(2 *_
) for nested keys, likeMEGA_LOG__LOG_PATH
forlog.log_path
.
- like
- Support
${}
syntax to reference other keys in the same file.- like
log_path = "${base_dir}/logs"
,${base_dir}
will be replaced by the value ofbase_dir
- or
key = "${xxx.yyy}/zzz"
(prefixxxx.
can't be omitted) - only support
String
type - substitute from up to down
- see codes in config.rs
- like
Example
config.toml
# the directory where the data files is located, such as logs, database, etc.
# can be overrided by environment variable `MEGA_BASE_DIR`
base_dir = "/tmp/.mega"
# Filling the following environment variables with values you set
## Logging Configuration
[log]
# The path which log file is saved
log_path = "${base_dir}/logs"
# log level
level = "debug"
# print std log in console, disable it on production for performance
print_std = true
[database]
# "sqlite" | "postgres"
# "sqlite" will use `db_path` and ignore `db_url`
db_type = "postgres"
# used for sqlite
db_path = "${base_dir}/mono.db"
# database connection url
db_url = "postgres://mono:mono@localhost:5432/mono"
# db max connection, setting it to twice the number of CPU cores would be appropriate.
max_connection = 32
# db min connection, setting it to the number of CPU cores would be appropriate.
min_connection = 16
# Whether to disabling SQLx Log
sqlx_logging = false
[storage]
obs_access_key = ""
obs_secret_key = ""
# cloud storage region
obs_region = "cn-east-3"
# Override the endpoint URL used for remote storage services
obs_endpoint = "https://obs.cn-east-3.myhuaweicloud.com"
[authentication]
# Support http authentication, login in with github and generate token before push
enable_http_auth = false
# Enable a test user for debugging and development purposes.
# If set to true, the service allows using a predefined test user for authentication.
enable_test_user = true
# Specify the name of the test user.
# This is only relevant if `enable_test_user` is set to true.
test_user_name = "mega"
# Specify the token for the test user.
# This is used for authentication when `enable_test_user` is set to true.
test_user_token = "mega"
[monorepo]
## Only import directory support multi-branch commit and tag, monorepo only support main branch
## Mega treats files under this directory as import repo and other directories as monorepo
import_dir = "/third-part"
# Set System Admin in directory init, replace the admin's github username here
admin = "admin"
# Set serveral root dirs in directory init
root_dirs = ["third-part", "project", "doc", "release"]
[pack]
# The maximum memory used by decode, Unit is GB
pack_decode_mem_size = 4
# The location where the object stored when the memory used by decode exceeds the limit
pack_decode_cache_path = "${base_dir}/cache"
clean_cache_after_decode = true
# The maximum meesage size in channel buffer while decode
channel_message_size = 1_000_000
# Maximum pack size, unit GB, enforces to use LFS off the limit
maximum_pack_size = 4
[lfs]
# LFS Server url
url = "http://localhost:8000"
# set the local path of the lfs storage
lfs_obj_local_path = "${base_dir}/lfs"
## IMPORTANT: The 'enable_split' feature can only be enabled for new databases. Existing databases do not support this feature.
# Enable or disable splitting large files into smaller chunks
enable_split = true # Default is disabled. Set to true to enable file splitting.
# Size of each file chunk when splitting is enabled, in bytes. Ignored if splitting is disabled.
split_size = 20971520 # Default size is 20MB (20971520 bytes)
[oauth]
# GitHub OAuth application client id and secret
github_client_id = ""
github_client_secret = ""
# Used for redirect to ui after login, for example: https://console.gitmono.com
ui_domain = "http://localhost:3000"
# Set your own domain here, for example: .gitmono.com
cookie_domain = "localhost"