feat(cache): 实现缓存服务器host.docker.internal支持和配置自动检测

- 在缓存服务器启动时自动将外部URL转换为host.docker.internal格式
- 添加useHostDockerInternal字段用于标识是否使用host.docker.internal映射
- 自动向容器选项添加--add-host=host.docker.internal:host-gateway参数
- 实现配置文件自动检测功能,当未指定配置文件时默认查找config.yaml
- 在cmd.go中添加PersistentPreRunE钩子函数进行配置文件预处理
- 添加调试输出语句用于跟踪缓存服务器启动流程
This commit is contained in:
dcsunny
2026-02-02 14:28:02 +08:00
parent f1a473b362
commit 8fab783aa9
3 changed files with 50 additions and 10 deletions

View File

@@ -15,6 +15,8 @@ import (
)
func Execute(ctx context.Context) {
configFile := ""
// ./act_runner
rootCmd := &cobra.Command{
Use: "act_runner [event name to run]\nIf no event name passed, will default to \"on: push\"",
@@ -22,8 +24,16 @@ func Execute(ctx context.Context) {
Args: cobra.MaximumNArgs(1),
Version: ver.Version(),
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// Auto-detect config.yaml if not specified
if configFile == "" {
if _, err := os.Stat("config.yaml"); err == nil {
configFile = "config.yaml"
}
}
return nil
},
}
configFile := ""
rootCmd.PersistentFlags().StringVarP(&configFile, "config", "c", "", "Config file path")
// ./act_runner register