test(bootstrap): add unit tests for initial bootstrap behavior
SonarQube Scan / SonarQube Trigger (push) Successful in 2m30s

This commit is contained in:
2026-01-24 15:42:30 +07:00
parent 1171b18340
commit 42c428c83d
9 changed files with 754 additions and 89 deletions
+8 -4
View File
@@ -8,6 +8,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"sync"
"time"
"tunnel_pls/internal/config"
@@ -47,15 +48,18 @@ func NewTLSConfig(config config.Config) (*tls.Config, error) {
var initErr error
tlsManagerOnce.Do(func() {
certPath := "certs/tls/cert.pem"
keyPath := "certs/tls/privkey.pem"
storagePath := "certs/tls/certmagic"
storagePath := config.TLSStoragePath()
cleanBase := filepath.Clean(storagePath)
certPath := filepath.Join(cleanBase, "cert.pem")
keyPath := filepath.Join(cleanBase, "privkey.pem")
storagePathCertMagic := filepath.Join(cleanBase, "certmagic")
tm := &tlsManager{
config: config,
certPath: certPath,
keyPath: keyPath,
storagePath: storagePath,
storagePath: storagePathCertMagic,
}
if tm.userCertsExistAndValid() {