Template
feat: Let's Encrypt SSL on site creation
This commit is contained in:
@@ -3,16 +3,20 @@ package config
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
DatabaseURL string
|
||||
HTTPPort string
|
||||
DefaultServerName string
|
||||
DefaultServerHost string
|
||||
DefaultServerIP string
|
||||
SessionCookieName string
|
||||
SessionTTLHours int
|
||||
DatabaseURL string
|
||||
HTTPPort string
|
||||
DefaultServerName string
|
||||
DefaultServerHost string
|
||||
DefaultServerIP string
|
||||
SessionCookieName string
|
||||
SessionTTLHours int
|
||||
ACMEEmail string
|
||||
ACMEStaging bool
|
||||
SSLStoragePath string
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
@@ -46,6 +50,11 @@ func Load() (*Config, error) {
|
||||
cookieName = "panel_session"
|
||||
}
|
||||
|
||||
sslPath := os.Getenv("SSL_STORAGE_PATH")
|
||||
if sslPath == "" {
|
||||
sslPath = "/etc/ssl/panel"
|
||||
}
|
||||
|
||||
return &Config{
|
||||
DatabaseURL: url,
|
||||
HTTPPort: port,
|
||||
@@ -53,6 +62,9 @@ func Load() (*Config, error) {
|
||||
DefaultServerHost: serverHost,
|
||||
DefaultServerIP: serverIP,
|
||||
SessionCookieName: cookieName,
|
||||
SessionTTLHours: 168, // 7 days
|
||||
SessionTTLHours: 168,
|
||||
ACMEEmail: strings.TrimSpace(os.Getenv("ACME_EMAIL")),
|
||||
ACMEStaging: os.Getenv("ACME_STAGING") == "true" || os.Getenv("ACME_STAGING") == "1",
|
||||
SSLStoragePath: sslPath,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user