diff --git a/common/src/config.rs b/common/src/config.rs index 33e7b0ea2..88e1f46bd 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -58,8 +58,11 @@ impl Default for Config { }) .collect::>() .join("\n"); - - let config_path = base_dir.join("config.toml"); + + // default config path: $MEGA_BASE_DIR/etc/config.toml + // ensure the directory exists + std::fs::create_dir_all(base_dir.join("etc")).unwrap(); + let config_path = base_dir.join("etc").join("config.toml"); std::fs::write(&config_path, default_config).unwrap(); eprintln!("create default config.toml in {:?}", &config_path); diff --git a/docker/README.md b/docker/README.md index 907727e54..f0701f0da 100644 --- a/docker/README.md +++ b/docker/README.md @@ -24,7 +24,7 @@ docker buildx build -t mega-moon:0.1-pre-release -f ./docker/mega_moon_dockerfil # create network docker network create mega-network -docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega/etc mega-mono:0.1-pre-release +docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega mega-mono:0.1-pre-release docker run --rm -it -d --network mega-network -e NEXT_PUBLIC_API_URL=http://mega-mono:8000 -p 3000:3000 mega-moon:0.1-pre-release ``` @@ -45,7 +45,7 @@ docker run --rm -it -d --network mega-network --name mega-db mega-db:0.1-pre-rel [2] create default config ```bash -docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega/etc mega-mono:0.1-pre-release +docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega mega-mono:0.1-pre-release docker stop mega-mono ``` @@ -65,6 +65,6 @@ db_url = "postgres://mega:mega@mega-db:5432/mega" [4] Start the mono again, and run the frontend. ```bash -docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega/etc mega-mono:0.1-pre-release +docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega mega-mono:0.1-pre-release docker run --rm -it -d --network mega-network -e NEXT_PUBLIC_API_URL=http://mega-mono:8000 -p 3000:3000 mega-moon:0.1-pre-release ``` \ No newline at end of file diff --git a/docker/start_mono.sh b/docker/start_mono.sh index fcf450684..f5382c885 100755 --- a/docker/start_mono.sh +++ b/docker/start_mono.sh @@ -6,7 +6,7 @@ CONFIG_FILE="$MEGA_BASE_DIR/etc/config.toml" # check if config file exists if [ -f "$CONFIG_FILE" ]; then echo "Using config file: $CONFIG_FILE" - exec /usr/local/bin/mono -c "$CONFIG_FILE" service http --host 0.0.0.0 + exec /usr/local/bin/mono -c "$CONFIG_FILE" service multi --host 127.0.0.1 --ssh-port 22 else - exec /usr/local/bin/mono service http --host 0.0.0.0 + exec /usr/local/bin/mono service multi --host 127.0.0.1 --ssh-port 22 fi \ No newline at end of file