修改go版本为1.15

This commit is contained in:
bjd 2021-01-08 13:09:04 +08:00
parent 8372b9e58e
commit 206cfebb9a
7 changed files with 18 additions and 20 deletions

View File

@ -16,7 +16,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.15
id: go
- name: Check out code into the Go module directory

View File

@ -2,7 +2,6 @@
package admin
import (
"embed"
"net/http"
"net/http/pprof"
@ -10,8 +9,6 @@ import (
"github.com/gorilla/mux"
)
var UiPath embed.FS
// 开启服务
func StartAdmin() {
@ -21,7 +18,7 @@ func StartAdmin() {
r.Handle("/", http.RedirectHandler("/ui/", http.StatusFound)).
Name("static")
r.PathPrefix("/ui/").Handler(http.FileServer(
http.FS(UiPath),
http.Dir(base.Cfg.UiPath),
)).Name("static")
r.HandleFunc("/base/login", Login).Name("login")

View File

@ -2,5 +2,5 @@ package base
const (
APP_NAME = "AnyLink"
APP_VER = "0.0.6"
APP_VER = "0.0.7"
)

View File

@ -39,7 +39,8 @@ type ServerConfig struct {
DbFile string `toml:"db_file" info:"数据库地址"`
CertFile string `toml:"cert_file" info:"证书文件"`
CertKey string `toml:"cert_key" info:"证书密钥"`
DownFilesPath string `json:"down_files_path" info:"外部下载文件路径"`
UiPath string `toml:"ui_path" info:"ui文件路径"`
DownFilesPath string `toml:"down_files_path" info:"外部下载文件路径"`
LogLevel string `toml:"log_level" info:"日志等级"`
Issuer string `toml:"issuer" info:"系统名称"`
AdminUser string `toml:"admin_user" info:"管理用户名"`

View File

@ -8,6 +8,7 @@ db_file = "./data.db"
#证书文件
cert_file = "./vpn_cert.pem"
cert_key = "./vpn_cert.key"
ui_path = "../ui"
down_files_path = "../down_files"
log_level = "info"

View File

@ -1,23 +1,28 @@
#!/usr/bin/env bash
git clone https://github.com/bjdgyc/anylink-web.git
#编译二进制文件
go build -o anylink -ldflags "-X main.COMMIT_ID=`git rev-parse HEAD`"
#编译前端项目
git clone https://github.com/bjdgyc/anylink-web.git
cd anylink-web
#国内可替换源加快速度
#npm install --registry=https://registry.npm.taobao.org
#npm run build --registry=https://registry.npm.taobao.org
npm install
npm run build
cd ../
cp -r anylink-web/ui .
go build -o anylink -ldflags "-X main.COMMIT_ID=`git rev-parse HEAD`"
#整理部署文件
mkdir anylink-deploy
cd anylink-deploy
cp -r ../anylink .
cp -r ../conf .
cp -r ../down_files .
cp -r anylink anylink-deploy
cp -r anylink-web/ui anylink-deploy
cp -r conf anylink-deploy
cp -r down_files anylink-deploy
#注意使用root权限运行
#cd anylink-deploy
#sudo ./anylink -conf="conf/server.toml"

View File

@ -2,25 +2,19 @@
package main
import (
"embed"
"os"
"os/signal"
"syscall"
"github.com/bjdgyc/anylink/admin"
"github.com/bjdgyc/anylink/base"
"github.com/bjdgyc/anylink/handler"
)
//go:embed ui/*
var UiPath embed.FS
// 程序版本
var COMMIT_ID string
func main() {
base.CommitId = COMMIT_ID
admin.UiPath = UiPath
base.Start()
handler.Start()