Skip to content

Commit 21ef912

Browse files
committed
refactor: 重命名相关文件和路径以支持新模块“anssl”
- 更新了日志文件和 PID 文件的名称。 - 修改了相关代码中的路径引用,确保与新模块名称一致。 - 更新了 README 文档以反映这些更改。
1 parent dab9822 commit 21ef912

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ go.work.sum
3232
# .vscode/
3333

3434
bin
35-
cert-deploy
35+
anssl
3636
certs
3737
ssl
3838
install.sh
3939
config.yaml
40-
cert-deploy.log
40+
anssl.log
4141
release.sh
4242
.DS_Store
4343
CLAUDE.md

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ sudo chmod 775 /etc/nginx/ssl
253253

254254
## 📁 文件位置
255255

256-
- **PID 文件**`~/.cert-deploy.pid`(用户主目录)
257-
- **日志文件**:与 `config.yaml` 同目录下的 `cert-deploy.log`
256+
- **PID 文件**`~/.anssl.pid`(用户主目录)
257+
- **日志文件**:与 `config.yaml` 同目录下的 `anssl.log`
258258
- **证书文件**
259259
- 下载的 zip 文件:`./certs/{domain}_certificates.zip`
260260
- 解压后的证书:`{ssl.path}/{domain}_certificates/`
@@ -272,7 +272,7 @@ $ ./anssl daemon -c config.yaml
272272

273273
```bash
274274
$ ./anssl status
275-
PID文件路径: /Users/username/.cert-deploy.pid
275+
PID文件路径: /Users/username/.anssl.pid
276276
证书部署守护进程正在运行 (PID: 12345)
277277
```
278278

@@ -381,8 +381,8 @@ make build-compress
381381

382382
1. 检查配置文件是否正确:`cat config.yaml`
383383
2. 使用前台模式查看错误:`./anssl start -c config.yaml`
384-
3. 检查 PID 文件是否被占用:`cat ~/.cert-deploy.pid`
385-
4. 如果进程异常退出,删除 PID 文件后重试:`rm ~/.cert-deploy.pid`
384+
3. 检查 PID 文件是否被占用:`cat ~/.anssl.pid`
385+
4. 如果进程异常退出,删除 PID 文件后重试:`rm ~/.anssl.pid`
386386

387387
### Nginx 未安装
388388

@@ -465,15 +465,15 @@ MIT License
465465

466466
```bash
467467
# 创建 systemd 服务文件
468-
sudo tee /etc/systemd/system/cert-deploy.service > /dev/null <<EOF
468+
sudo tee /etc/systemd/system/anssl.service > /dev/null <<EOF
469469
[Unit]
470470
Description=Certificate Deploy Service
471471
After=network.target
472472
473473
[Service]
474474
Type=simple
475475
User=root
476-
ExecStart=/usr/local/bin/anssl start -c /etc/cert-deploy/config.yaml
476+
ExecStart=/usr/local/bin/anssl start -c /etc/anssl/config.yaml
477477
Restart=always
478478
RestartSec=10
479479
@@ -483,11 +483,11 @@ EOF
483483

484484
# 启用并启动服务
485485
sudo systemctl daemon-reload
486-
sudo systemctl enable cert-deploy
487-
sudo systemctl start cert-deploy
486+
sudo systemctl enable anssl
487+
sudo systemctl start anssl
488488

489489
# 查看服务状态
490-
sudo systemctl status cert-deploy
490+
sudo systemctl status anssl
491491
```
492492

493493
### 5. 如何验证证书部署成功?

cmd/daemon.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func runSupervisor() {
163163
} else {
164164
// 检查更新标记(程序同级目录)
165165
execDir := filepath.Dir(execPath)
166-
updateMarker := filepath.Join(execDir, ".cert-deploy-updated")
166+
updateMarker := filepath.Join(execDir, ".anssl-updated")
167167
if _, err := os.Stat(updateMarker); err == nil {
168168
logSupervisor("应用更新,重启中...")
169169
os.Remove(updateMarker)
@@ -185,7 +185,7 @@ func shouldStopSupervisor() bool {
185185
// 如果无法获取用户主目录,使用当前目录
186186
homeDir = "."
187187
}
188-
stopMarker := filepath.Join(homeDir, ".cert-deploy-stop")
188+
stopMarker := filepath.Join(homeDir, ".anssl-stop")
189189
if _, err := os.Stat(stopMarker); err == nil {
190190
os.Remove(stopMarker)
191191
return true
@@ -200,7 +200,7 @@ func StopDaemon() error {
200200
// 如果无法获取用户主目录,使用当前目录
201201
homeDir = "."
202202
}
203-
stopMarker := filepath.Join(homeDir, ".cert-deploy-stop")
203+
stopMarker := filepath.Join(homeDir, ".anssl-stop")
204204
if err := os.WriteFile(stopMarker, []byte("stop"), 0600); err != nil {
205205
return fmt.Errorf("创建停止标记失败: %w", err)
206206
}

cmd/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ func GetPIDFile() string {
4848
// 如果无法获取用户主目录,使用当前目录
4949
homeDir = "."
5050
}
51-
return filepath.Join(homeDir, ".cert-deploy.pid")
51+
return filepath.Join(homeDir, ".anssl.pid")
5252
}
5353

5454
// GetLogFile 获取日志文件路径(与配置文件同一目录)
5555
func GetLogFile() string {
5656
configDir := filepath.Dir(ConfigFile)
57-
return filepath.Join(configDir, "cert-deploy.log")
57+
return filepath.Join(configDir, "anssl.log")
5858
}
5959

6060
// IsRunning 检查守护进程是否在运行

cmd/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func CreateStartCmd() *cobra.Command {
3030
// 检查更新标记并清理(程序同级目录)
3131
execPath, _ := os.Executable()
3232
execDir := filepath.Dir(execPath)
33-
markerFile := filepath.Join(execDir, ".cert-deploy-updated")
33+
markerFile := filepath.Join(execDir, ".anssl-updated")
3434
if _, err := os.Stat(markerFile); err == nil {
3535
logger.Info("更新成功")
3636
os.Remove(markerFile)

internal/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func (c *Client) downloadFile(downloadURL, filePath string) error {
323323
}
324324

325325
// 创建临时文件,确保部分下载不会污染最终文件
326-
tmpFile, err := os.CreateTemp(filepath.Dir(filePath), ".cert-deploy-*")
326+
tmpFile, err := os.CreateTemp(filepath.Dir(filePath), ".anssl-*")
327327
if err != nil {
328328
return err
329329
}

internal/client/update_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (c *Client) handleUpdate() {
4040
return
4141
}
4242
execDir := filepath.Dir(execPath)
43-
markerFile := filepath.Join(execDir, ".cert-deploy-updated")
43+
markerFile := filepath.Join(execDir, ".anssl-updated")
4444
content := fmt.Sprintf("%s\n%s\n", updateInfo.LatestVersion, time.Now().Format(time.RFC3339))
4545
if err := os.WriteFile(markerFile, []byte(content), 0600); err != nil {
4646
logger.Error("创建更新标记文件失败", "error", err)

internal/system/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"time"
1313
)
1414

15-
const cacheRelPath = "cert-deploy/client-id"
15+
const cacheRelPath = "anssl/client-id"
1616

1717
// SystemInfo 系统信息结构
1818
type SystemInfo struct {

0 commit comments

Comments
 (0)