mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 15:00:26 +08:00
阶段性提交
This commit is contained in:
51
build/build.sh
Executable file
51
build/build.sh
Executable 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
8
build/config.sh
Executable 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
1
build/configs/README.md
Normal file
@@ -0,0 +1 @@
|
||||
* `global.yaml` - 全局配置
|
||||
@@ -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
1
build/logs/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.log
|
||||
Reference in New Issue
Block a user