mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
27 lines
No EOL
582 B
Go
27 lines
No EOL
582 B
Go
package container
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
type CommandInfo struct {
|
|
User string
|
|
Privileged bool
|
|
Env []string
|
|
Cmd []string
|
|
}
|
|
|
|
func ReadCommandInfoFromJSON(commandInfoJSON string) (CommandInfo, error) {
|
|
commandInfo := CommandInfo{}
|
|
|
|
err := json.Unmarshal([]byte(commandInfoJSON), &commandInfo)
|
|
if err != nil {
|
|
return CommandInfo{}, err
|
|
}
|
|
|
|
return commandInfo, nil
|
|
}
|
|
|
|
func (commandInfo CommandInfo) IsDefined() bool {
|
|
return commandInfo.Cmd != nil && len(commandInfo.Cmd) > 0
|
|
} |