fixed event name missing

This commit is contained in:
yusing 2024-10-04 06:51:26 +08:00
parent b679655cd5
commit 31080edd59
2 changed files with 13 additions and 4 deletions

View file

@ -5,8 +5,7 @@
"config.yml" "config.yml"
], ],
"https://github.com/yusing/go-proxy/raw/main/schema/providers.schema.json": [ "https://github.com/yusing/go-proxy/raw/main/schema/providers.schema.json": [
"providers.example.yml", "providers.example.yml"
"*.yml"
] ]
} }
} }

View file

@ -53,11 +53,21 @@ var DockerEventMap = map[dockerEvents.Action]Action{
dockerEvents.ActionDie: ActionContainerDie, dockerEvents.ActionDie: ActionContainerDie,
} }
var dockerActionNameMap = func() (m map[Action]string) { var fileActionNameMap = map[Action]string{
ActionFileWritten: "written",
ActionFileCreated: "created",
ActionFileDeleted: "deleted",
ActionFileRenamed: "renamed",
}
var actionNameMap = func() (m map[Action]string) {
m = make(map[Action]string, len(DockerEventMap)) m = make(map[Action]string, len(DockerEventMap))
for k, v := range DockerEventMap { for k, v := range DockerEventMap {
m[v] = string(k) m[v] = string(k)
} }
for k, v := range fileActionNameMap {
m[k] = v
}
return return
}() }()
@ -66,7 +76,7 @@ func (e Event) String() string {
} }
func (a Action) String() string { func (a Action) String() string {
return dockerActionNameMap[a] return actionNameMap[a]
} }
func (a Action) IsContainerWake() bool { func (a Action) IsContainerWake() bool {