修改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 - name: Set up Go 1.x
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.16 go-version: 1.15
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory

View File

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

View File

@ -2,5 +2,5 @@ package base
const ( const (
APP_NAME = "AnyLink" 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:"数据库地址"` DbFile string `toml:"db_file" info:"数据库地址"`
CertFile string `toml:"cert_file" info:"证书文件"` CertFile string `toml:"cert_file" info:"证书文件"`
CertKey string `toml:"cert_key" 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:"日志等级"` LogLevel string `toml:"log_level" info:"日志等级"`
Issuer string `toml:"issuer" info:"系统名称"` Issuer string `toml:"issuer" info:"系统名称"`
AdminUser string `toml:"admin_user" info:"管理用户名"` AdminUser string `toml:"admin_user" info:"管理用户名"`

View File

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

View File

@ -1,23 +1,28 @@
#!/usr/bin/env bash #!/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 cd anylink-web
#国内可替换源加快速度
#npm install --registry=https://registry.npm.taobao.org
#npm run build --registry=https://registry.npm.taobao.org
npm install npm install
npm run build npm run build
cd ../ cd ../
cp -r anylink-web/ui .
go build -o anylink -ldflags "-X main.COMMIT_ID=`git rev-parse HEAD`"
#整理部署文件 #整理部署文件
mkdir anylink-deploy mkdir anylink-deploy
cd anylink-deploy
cp -r ../anylink . cp -r anylink anylink-deploy
cp -r ../conf . cp -r anylink-web/ui anylink-deploy
cp -r ../down_files . cp -r conf anylink-deploy
cp -r down_files anylink-deploy
#注意使用root权限运行 #注意使用root权限运行
#cd anylink-deploy
#sudo ./anylink -conf="conf/server.toml" #sudo ./anylink -conf="conf/server.toml"

View File

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