阶段性提交

This commit is contained in:
刘祥超
2020-09-09 18:53:53 +08:00
parent fa7edac94b
commit be9fc79b92
115 changed files with 7910 additions and 744 deletions

51
build/build.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
function build() {
VERSION_DATA=$(cat ../internal/const/const.go)
re="Version[ ]+=[ ]+\"([0-9.]+)\""
if [[ $VERSION_DATA =~ $re ]]; then
VERSION=${BASH_REMATCH[1]}
else
echo "could not match version"
exit
fi
echo "checking ..."
ZIP_PATH=$(which zip)
if [ -z $ZIP_PATH ]; then
echo "we need 'zip' command to compress files"
exit
fi
echo "building v${VERSION}/${1}/${2} ..."
NAME="edge-node"
DIST="../dist/${NAME}"
ZIP="${NAME}-${1}-${2}-v${VERSION}.zip"
echo "copying ..."
if [ ! -d $DIST ]; then
mkdir $DIST
mkdir $DIST/bin
mkdir $DIST/configs
mkdir $DIST/logs
fi
cp configs/api.template.yaml $DIST/configs
cp -R www $DIST/
echo "building ..."
env GOOS=${1} GOARCH=${2} go build -o $DIST/bin/${NAME} -ldflags="-s -w" ../cmd/edge-node/main.go
echo "zip files"
cd "${DIST}/../" || exit
if [ -f "${ZIP}" ]; then
rm -f "${ZIP}"
fi
zip -r -X -q "${ZIP}" ${NAME}/
rm -rf ${NAME}
cd - || exit
echo "OK"
}
build "linux" "amd64"

8
build/config.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
TARGET=../../EdgeAdmin/internal/serverconfigs
if [ -d ${TARGET} ]
then
rm -rf ../../EdgeAdmin/internal/serverconfigs
fi
cp -R ../internal/configs/serverconfigs ../../EdgeAdmin/internal/configs/

1
build/configs/README.md Normal file
View File

@@ -0,0 +1 @@
* `global.yaml` - 全局配置

View File

@@ -1,4 +1,4 @@
rpc:
endpoints: [ "127.0.0.1:8003" ]
nodeId: ""
secret: ""
endpoints: [ ${endpoints} ]
nodeId: "${nodeId}"
secret: "${nodeSecret}"

1
build/logs/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.log