Parcourir la source

fix(caddy): use correct env placeholder syntax

Change {env.VAR} to {} for global env placeholder
Add * matcher to basicauth for all paths
lushdog@outlook.com il y a 1 mois
Parent
commit
d162615c84
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      Caddyfile

+ 5 - 3
Caddyfile

@@ -1,7 +1,9 @@
 love.hdlife.me {
-	# Basic Auth - 使用环境变量中的哈希密码
-	basicauth {
-		{env.BASIC_AUTH_USER} {env.BASIC_AUTH_HASH}
+	# Basic Auth - 用户名和密码从环境变量读取
+	# 密码必须是 bcrypt 格式,生成命令:
+	# docker run --rm caddy:2-alpine caddy hash-password --plaintext 'your_password'
+	basicauth * {
+		{$BASIC_AUTH_USER} {$BASIC_AUTH_HASH}
 	}
 
 	# 反向代理到 byreal-table 服务