Skip to content

Commit efa9487

Browse files
committed
发布包添加默认配置模板
1 parent 3e60e18 commit efa9487

5 files changed

Lines changed: 125 additions & 32 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,33 @@ jobs:
100100
echo "Build macOS..."
101101
mkdir -p build/darwin-amd64 build/darwin-arm64
102102
GOOS=darwin GOARCH=amd64 go build -ldflags="${STRIP_LDFLAGS}" -trimpath -o build/darwin-amd64/anssl main.go
103-
tar -C build/darwin-amd64 -czf release/anssl-darwin-amd64.tar.gz anssl
103+
cp config.example.yaml build/darwin-amd64/config.yaml
104+
tar -C build/darwin-amd64 -czf release/anssl-darwin-amd64.tar.gz anssl config.yaml
104105
GOOS=darwin GOARCH=arm64 go build -ldflags="${STRIP_LDFLAGS}" -trimpath -o build/darwin-arm64/anssl main.go
105-
tar -C build/darwin-arm64 -czf release/anssl-darwin-arm64.tar.gz anssl
106+
cp config.example.yaml build/darwin-arm64/config.yaml
107+
tar -C build/darwin-arm64 -czf release/anssl-darwin-arm64.tar.gz anssl config.yaml
106108
107109
echo "Build Linux..."
108110
mkdir -p build/linux-amd64 build/linux-arm64
109111
GOOS=linux GOARCH=amd64 go build -ldflags="${STRIP_LDFLAGS}" -trimpath -o build/linux-amd64/anssl main.go
110112
echo "UPX compress linux-amd64..."
111113
upx --best build/linux-amd64/anssl || echo "⚠️ ignore UPX failure: linux-amd64"
112-
tar -C build/linux-amd64 -czf release/anssl-linux-amd64.tar.gz anssl
114+
cp config.example.yaml build/linux-amd64/config.yaml
115+
tar -C build/linux-amd64 -czf release/anssl-linux-amd64.tar.gz anssl config.yaml
113116
GOOS=linux GOARCH=arm64 go build -ldflags="${STRIP_LDFLAGS}" -trimpath -o build/linux-arm64/anssl main.go
114117
echo "UPX compress linux-arm64..."
115118
upx --best build/linux-arm64/anssl || echo "⚠️ ignore UPX failure: linux-arm64"
116-
tar -C build/linux-arm64 -czf release/anssl-linux-arm64.tar.gz anssl
119+
cp config.example.yaml build/linux-arm64/config.yaml
120+
tar -C build/linux-arm64 -czf release/anssl-linux-arm64.tar.gz anssl config.yaml
117121
118122
echo "Build Windows..."
119123
mkdir -p build/windows-amd64 build/windows-arm64
120124
GOOS=windows GOARCH=amd64 go build -ldflags="${BASE_LDFLAGS}" -trimpath -o build/windows-amd64/anssl.exe main.go
121-
(cd build/windows-amd64 && zip -q ../../release/anssl-windows-amd64.zip anssl.exe)
125+
cp config.example.yaml build/windows-amd64/config.yaml
126+
(cd build/windows-amd64 && zip -q ../../release/anssl-windows-amd64.zip anssl.exe config.yaml)
122127
GOOS=windows GOARCH=arm64 go build -ldflags="${BASE_LDFLAGS}" -trimpath -o build/windows-arm64/anssl.exe main.go
123-
(cd build/windows-arm64 && zip -q ../../release/anssl-windows-arm64.zip anssl.exe)
128+
cp config.example.yaml build/windows-arm64/config.yaml
129+
(cd build/windows-arm64 && zip -q ../../release/anssl-windows-arm64.zip anssl.exe config.yaml)
124130
125131
- name: Show build info
126132
run: |

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ build-mac:
1212
@echo "构建 Mac 版本..."
1313
@mkdir -p bin bin/darwin-amd64 bin/darwin-arm64
1414
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o bin/darwin-amd64/anssl main.go
15-
@tar -C bin/darwin-amd64 -czf bin/anssl-darwin-amd64.tar.gz anssl
15+
@cp config.example.yaml bin/darwin-amd64/config.yaml
16+
@tar -C bin/darwin-amd64 -czf bin/anssl-darwin-amd64.tar.gz anssl config.yaml
1617
@GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/darwin-arm64/anssl main.go
17-
@tar -C bin/darwin-arm64 -czf bin/anssl-darwin-arm64.tar.gz anssl
18+
@cp config.example.yaml bin/darwin-arm64/config.yaml
19+
@tar -C bin/darwin-arm64 -czf bin/anssl-darwin-arm64.tar.gz anssl config.yaml
1820
@rm -rf bin/darwin-amd64 bin/darwin-arm64
1921
@echo "Mac 版本构建完成"
2022

@@ -29,15 +31,17 @@ build-linux:
2931
else \
3032
echo "UPX 未安装,跳过 linux-amd64 压缩"; \
3133
fi
32-
@tar -C bin/linux-amd64 -czf bin/anssl-linux-amd64.tar.gz anssl
34+
@cp config.example.yaml bin/linux-amd64/config.yaml
35+
@tar -C bin/linux-amd64 -czf bin/anssl-linux-amd64.tar.gz anssl config.yaml
3336
@GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o bin/linux-arm64/anssl main.go
3437
@echo "尝试使用 UPX 压缩 linux-arm64 二进制..."
3538
@if command -v upx >/dev/null 2>&1; then \
3639
upx --best bin/linux-arm64/anssl || echo "UPX 压缩失败(linux-arm64),已忽略"; \
3740
else \
3841
echo "UPX 未安装,跳过 linux-arm64 压缩"; \
3942
fi
40-
@tar -C bin/linux-arm64 -czf bin/anssl-linux-arm64.tar.gz anssl
43+
@cp config.example.yaml bin/linux-arm64/config.yaml
44+
@tar -C bin/linux-arm64 -czf bin/anssl-linux-arm64.tar.gz anssl config.yaml
4145
@rm -rf bin/linux-amd64 bin/linux-arm64
4246
@echo "Linux 版本构建完成"
4347

@@ -46,9 +50,11 @@ build-windows:
4650
@echo "构建 Windows 版本..."
4751
@mkdir -p bin bin/windows-amd64 bin/windows-arm64
4852
@GOOS=windows GOARCH=amd64 go build -trimpath -o bin/windows-amd64/anssl.exe main.go
49-
@cd bin/windows-amd64 && zip -q ../../bin/anssl-windows-amd64.zip anssl.exe
53+
@cp config.example.yaml bin/windows-amd64/config.yaml
54+
@cd bin/windows-amd64 && zip -q ../../bin/anssl-windows-amd64.zip anssl.exe config.yaml
5055
@GOOS=windows GOARCH=arm64 go build -trimpath -o bin/windows-arm64/anssl.exe main.go
51-
@cd bin/windows-arm64 && zip -q ../../bin/anssl-windows-arm64.zip anssl.exe
56+
@cp config.example.yaml bin/windows-arm64/config.yaml
57+
@cd bin/windows-arm64 && zip -q ../../bin/anssl-windows-arm64.zip anssl.exe config.yaml
5258
@rm -rf bin/windows-amd64 bin/windows-arm64
5359
@echo "Windows 版本构建完成"
5460

README.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ sudo mv anssl /usr/local/bin/
2828

2929
### 2. 配置
3030

31-
创建 `config.yaml` 文件:
31+
发布包中已包含 `config.yaml` 模板。启动前请修改其中的 `accessKey` 和需要启用的部署目标。
32+
33+
如果从源码运行,可以复制模板:
34+
35+
```bash
36+
cp config.example.yaml config.yaml
37+
```
38+
39+
`config.yaml` 示例:
3240

3341
```yaml
3442
server:
@@ -38,18 +46,26 @@ server:
3846
port: 19000
3947

4048
ssl:
41-
# Nginx 证书目录(可选)
42-
nginxPath: "/etc/nginx/ssl"
43-
# Apache 证书目录(可选)
44-
apachePath: "/etc/apache2/ssl"
45-
# RustFS TLS 证书目录(可选)
46-
rustFSPath: "/etc/rustfs/tls"
49+
# Nginx 证书目录(可选,留空则不部署到 Nginx
50+
nginxPath: ""
51+
# Apache 证书目录(可选,留空则不部署到 Apache
52+
apachePath: ""
53+
# RustFS TLS 证书目录(可选,留空则不部署到 RustFS
54+
rustFSPath: ""
4755
# 飞牛部署(可选)
4856
feiNiuEnabled: false
49-
# 1Panel 配置(可选)
57+
# 1Panel 配置(可选,留空则不部署到 1Panel
5058
onePanel:
51-
url: "http://localhost:10000" # 1Panel 面板地址
52-
apiKey: "your-1panel-api-key" # 1Panel API密钥
59+
url: ""
60+
apiKey: ""
61+
62+
update:
63+
# 镜像源类型:github、ghproxy、ghproxy2、custom
64+
mirror: "ghproxy"
65+
# 使用 custom 镜像源时填写
66+
customUrl: ""
67+
# HTTP 代理地址(可选)
68+
proxy: ""
5369

5470
# 云服务配置(可选)
5571
provider:

README_EN.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ sudo mv anssl /usr/local/bin/
2828

2929
### 2. Configure
3030

31-
Create a `config.yaml` file:
31+
Release archives include a `config.yaml` template. Before starting, edit its `accessKey` and any deployment targets you want to enable.
32+
33+
If you run from source, copy the template first:
34+
35+
```bash
36+
cp config.example.yaml config.yaml
37+
```
38+
39+
`config.yaml` example:
3240

3341
```yaml
3442
server:
@@ -38,18 +46,26 @@ server:
3846
port: 19000
3947

4048
ssl:
41-
# Nginx certificate directory (optional)
42-
nginxPath: "/etc/nginx/ssl"
43-
# Apache certificate directory (optional)
44-
apachePath: "/etc/apache2/ssl"
45-
# RustFS TLS certificate directory (optional)
46-
rustFSPath: "/etc/rustfs/tls"
49+
# Nginx certificate directory (optional; leave empty to disable Nginx deployment)
50+
nginxPath: ""
51+
# Apache certificate directory (optional; leave empty to disable Apache deployment)
52+
apachePath: ""
53+
# RustFS TLS certificate directory (optional; leave empty to disable RustFS deployment)
54+
rustFSPath: ""
4755
# FeiNiu deployment (optional)
4856
feiNiuEnabled: false
49-
# 1Panel configuration (optional)
57+
# 1Panel configuration (optional; leave empty to disable 1Panel deployment)
5058
onePanel:
51-
url: "http://localhost:10000" # 1Panel panel URL
52-
apiKey: "your-1panel-api-key" # 1Panel API key
59+
url: ""
60+
apiKey: ""
61+
62+
update:
63+
# Mirror type: github, ghproxy, ghproxy2, custom
64+
mirror: "ghproxy"
65+
# Required when mirror is custom
66+
customUrl: ""
67+
# HTTP proxy URL (optional)
68+
proxy: ""
5369

5470
# Cloud provider configuration (optional)
5571
provider:

config.example.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# anssl 配置模板
2+
server:
3+
# 从 anssl.cn 设置 -> 个人资料 中获取
4+
accessKey: "your_access_key_here"
5+
# HTTP-01 验证服务端口
6+
port: 19000
7+
8+
ssl:
9+
# Nginx 证书目录(可选,留空则不部署到 Nginx)
10+
nginxPath: ""
11+
# Apache 证书目录(可选,留空则不部署到 Apache)
12+
apachePath: ""
13+
# RustFS TLS 证书目录(可选,留空则不部署到 RustFS)
14+
rustFSPath: ""
15+
# 飞牛部署(可选)
16+
feiNiuEnabled: false
17+
# 1Panel 配置(可选,留空则不部署到 1Panel)
18+
onePanel:
19+
url: ""
20+
apiKey: ""
21+
22+
update:
23+
# 镜像源类型:github、ghproxy、ghproxy2、custom
24+
mirror: "ghproxy"
25+
# 使用 custom 镜像源时填写
26+
customUrl: ""
27+
# HTTP 代理地址(可选)
28+
proxy: ""
29+
30+
# 云服务配置(可选)
31+
# provider:
32+
# - name: "aliyun"
33+
# remark: "阿里云"
34+
# auth:
35+
# accessKeyId: "your-aliyun-access-key-id"
36+
# accessKeySecret: "your-aliyun-access-key-secret"
37+
# esaSiteId: "your-esa-site-id"
38+
#
39+
# - name: "qiniu"
40+
# remark: "七牛云"
41+
# auth:
42+
# accessKey: "your-qiniu-access-key"
43+
# accessSecret: "your-qiniu-access-secret"
44+
#
45+
# - name: "cloudTencent"
46+
# remark: "腾讯云"
47+
# auth:
48+
# secretId: "your-tencent-secret-id"
49+
# secretKey: "your-tencent-secret-key"

0 commit comments

Comments
 (0)