MCPcopy
hub / github.com/filebrowser/filebrowser / RunCommand

Method RunCommand

auth/hook.go:87–101  ·  view source on GitHub ↗

RunCommand starts the hook command and returns the action

()

Source from the content-addressed store, hash-verified

85
86// RunCommand starts the hook command and returns the action
87func (a *HookAuth) RunCommand() (string, error) {
88 command := strings.Split(a.Command, " ")
89
90 cmd := exec.Command(command[0], command[1:]...)
91 cmd.Env = append(os.Environ(), fmt.Sprintf("USERNAME=%s", a.Cred.Username))
92 cmd.Env = append(cmd.Env, fmt.Sprintf("PASSWORD=%s", a.Cred.Password))
93 out, err := cmd.Output()
94 if err != nil {
95 return "", err
96 }
97
98 a.GetValues(string(out))
99
100 return a.Fields.Values["hook.action"], nil
101}
102
103// GetValues creates a map with values from the key-value format string
104func (a *HookAuth) GetValues(s string) {

Callers 3

AuthMethod · 0.95

Calls 1

GetValuesMethod · 0.95