From 3def5f08a784afbc31d09e10beb167856f1f1804 Mon Sep 17 00:00:00 2001 From: Sydonian <794346190@qq.com> Date: Fri, 28 Apr 2023 15:54:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=89=80=E6=9C=89=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=A7=BB=E5=8A=A8=E5=88=B0conf=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 6 +++--- assets/config/config.json | 17 ----------------- internal/config/config.go | 2 +- 3 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 assets/config/config.json diff --git a/Makefile b/Makefile index 59c4ad2..45ac1f7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -OUTPUT_BINARY_NAME = "cloud-agent" -OUTPUT_DIR_NAME = "cloud-agent" +OUTPUT_BINARY_NAME = "agent" +OUTPUT_DIR_NAME = "agent" ASSETS_DIR_NAME = "assets" @@ -7,7 +7,7 @@ BUILD_DIR = "../../build" build: go build -o ${BUILD_DIR}/${OUTPUT_DIR_NAME}/${OUTPUT_BINARY_NAME} - @if [ -d ${ASSETS_DIR_NAME} ];then \ + @if [ -d ${ASSETS_DIR_NAME} ] && [ -n "`ls -A ${ASSETS_DIR_NAME}`" ] ;then \ cp -r ${ASSETS_DIR_NAME}/* ${BUILD_DIR}/${OUTPUT_DIR_NAME}/; \ fi diff --git a/assets/config/config.json b/assets/config/config.json deleted file mode 100644 index 2b4d786..0000000 --- a/assets/config/config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "id": 0, - "grpcListenAddress": "127.0.0.1:5010", - "localIP": "localhost", - "ipfsPort": 5001, - "storageBaseDir": ".", - "logger": { - "outputFileName": "cloud-agent", - "outputDirectory": "log", - "level": "debug" - }, - "rabbitMQ": { - "address": "127.0.0.1:5672", - "account": "guest", - "password": "guest" - } -} \ No newline at end of file diff --git a/internal/config/config.go b/internal/config/config.go index 8b84a89..5e54aba 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -19,7 +19,7 @@ type Config struct { var cfg Config func Init() error { - return c.DefaultLoad(&cfg) + return c.DefaultLoad("agent", &cfg) } func Cfg() *Config {