diff --git a/docs/development.md b/docs/development.md index 7cd1d007..8438de18 100644 --- a/docs/development.md +++ b/docs/development.md @@ -147,7 +147,7 @@ ```bash $ cd mega - $ cargo run init -d postgres + $ cargo run init ``` 7. Start the Mega server for testing. @@ -260,7 +260,7 @@ [database] # database connection url - db_url = "postgres://postgres:postgres@localhost:5432/mega" + db_url = "postgres://mega:mega@localhost:5432/mega" # db max connection, setting it to twice the number of CPU cores would be appropriate. max_connection = 32 @@ -310,7 +310,14 @@ pack_decode_cache_path = "/tmp/.mega/cache" clean_cache_after_decode = true + + [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 = false # 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) ``` @@ -318,7 +325,7 @@ ```bash $ cd mega - $ cargo run init -d postgres + $ cargo run init ``` 7. Start Mega server. @@ -382,7 +389,7 @@ Config `confg.toml` file for the Mega project. [database] # database connection url - db_url = "postgres://postgres:postgres@localhost:5432/mega" + db_url = "postgres://mega:mega@localhost:5432/mega" # db max connection, setting it to twice the number of CPU cores would be appropriate. max_connection = 2 @@ -430,6 +437,14 @@ Config `confg.toml` file for the Mega project. pack_decode_cache_path = "/tmp/.mega/cache" clean_cache_after_decode = true + + [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 = false # 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) ``` ## Comment Guideline diff --git a/mega/config.toml b/mega/config.toml index cd18828b..007acc16 100644 --- a/mega/config.toml +++ b/mega/config.toml @@ -13,7 +13,7 @@ print_std = true [database] # database connection url -db_url = "postgres://postgres:postgres@localhost:5432/mega" +db_url = "postgres://mega:mega@localhost:5432/mega" # db max connection, setting it to twice the number of CPU cores would be appropriate. max_connection = 32 @@ -75,5 +75,9 @@ hub = "http://127.0.0.1:8888" agent = "http://127.0.0.1:7777" [lfs] -enable_split = true -split_size = 20971520 # 20MB \ No newline at end of file +## 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) \ No newline at end of file diff --git a/mega/config.toml.example b/mega/config.toml.example deleted file mode 100644 index 8406dc7b..00000000 --- a/mega/config.toml.example +++ /dev/null @@ -1,69 +0,0 @@ -# Filling the following environment variables with values you set -## Logging Configuration -[log] -# The path which log file is saved -log_path = "/tmp/.mega/logs" - -# log level -level = "debug" - -# print std log in console, disable it on production for performance -print_std = true - - -[database] -# database connection url -db_url = "postgres://postgres:postgres@localhost:5432/mega" - -# 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 - - -[ssh] -ssh_key_path = "/tmp/.mega/ssh" - -[storage] -# raw object stroage type, can be `local` or `remote` -raw_obj_storage_type = "LOCAL" - -## If the object file size exceeds the threshold value, it will be handled by file storage instead of the database, Unit is KB -big_obj_threshold = 1024 - -# set the local path of the project storage -raw_obj_local_path = "/tmp/.mega/objects" - -lfs_obj_local_path = "/tmp/.mega/lfs" - -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" - - -[monorepo] -## Only import directory support multi-branch commit and tag, repo under regular directory only support main branch only -## Mega treats files under this directory as import repo and other directories as monorepo -import_dir = "/third-part" - - -[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 = "/tmp/.mega/cache" - -clean_cache_after_decode = true - -# The maximum meesage size in channel buffer while decode -channel_message_size = 1_000_000 \ No newline at end of file diff --git a/mega/src/build.rs b/mega/src/build.rs index 77fc2d86..27ec449e 100644 --- a/mega/src/build.rs +++ b/mega/src/build.rs @@ -4,5 +4,9 @@ //! fn main() -> shadow_rs::SdResult<()> { + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN"); + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path"); shadow_rs::new() } \ No newline at end of file