perf: change default data directory (#185)

This commit is contained in:
Hengfei Yang 2023-03-02 14:52:37 +08:00 committed by GitHub
parent 98fb399713
commit f305673629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,5 @@
ZO_ROOT_USER_EMAIL = "root@example.com"
ZO_ROOT_USER_PASSWORD = "Complexpass#123"
ZO_DATA_DIR = "./data/"
ZO_MAX_FILE_SIZE_ON_DISK = 32
ZO_FILE_PUSH_INTERVAL = 10
ZO_S3_BUCKET_NAME = "zinc-dev"

View File

@ -122,11 +122,11 @@ pub struct Common {
pub node_role: String,
#[env_config(name = "ZO_INSTANCE_NAME", default = "")]
pub instance_name: String,
#[env_config(name = "ZO_DATA_DIR", default = "./data/")]
#[env_config(name = "ZO_DATA_DIR", default = "./data/zincobserve/")]
pub data_dir: String,
#[env_config(name = "ZO_DATA_WAL_DIR", default = "")] // ./data/wal/
#[env_config(name = "ZO_DATA_WAL_DIR", default = "")] // ./data/zincobserve/wal/
pub data_wal_dir: String,
#[env_config(name = "ZO_DATA_STREAM_DIR", default = "")] // ./data/stream/
#[env_config(name = "ZO_DATA_STREAM_DIR", default = "")] // ./data/zincobserve/stream/
pub data_stream_dir: String,
#[env_config(name = "ZO_WAL_MEMORY_MODE_ENABLED", default = false)]
pub wal_memory_mode_enabled: bool,
@ -262,7 +262,7 @@ pub struct Etcd {
#[derive(Clone, Debug, EnvConfig)]
pub struct Sled {
#[env_config(name = "ZO_SLED_DATA_DIR", default = "")] // ./data/db/
#[env_config(name = "ZO_SLED_DATA_DIR", default = "")] // ./data/zincobserve/db/
pub data_dir: String,
#[env_config(name = "ZO_SLED_PREFIX", default = "/zinc/observe/")]
pub prefix: String,
@ -336,7 +336,7 @@ pub fn init() -> Config {
fn check_path_config(cfg: &mut Config) -> Result<(), anyhow::Error> {
if cfg.common.data_dir.is_empty() {
cfg.common.data_dir = "./data/".to_string();
cfg.common.data_dir = "./data/zincobserve/".to_string();
}
if !cfg.common.data_dir.ends_with('/') {
cfg.common.data_dir = format!("{}/", cfg.common.data_dir);