MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / LoadServiceName

Function LoadServiceName

agent/utils/controller/controller.go:146–162  ·  view source on GitHub ↗
(keyword string)

Source from the content-addressed store, hash-verified

144}
145
146func LoadServiceName(keyword string) (string, error) {
147 client, err := New()
148 if err != nil {
149 return "", err
150 }
151
152 processedName := loadProcessedName(client.Name(), keyword)
153 exist, _ := client.IsExist(processedName)
154 if exist {
155 return processedName, nil
156 }
157 alistName := loadFromPredefined(client, keyword)
158 if len(alistName) != 0 {
159 return alistName, nil
160 }
161 return "", fmt.Errorf("find such service for %s failed", keyword)
162}
163
164func loadProcessedName(mgr, keyword string) string {
165 keyword = strings.ToLower(keyword)

Callers 8

HandleFunction · 0.70
HandleStartFunction · 0.70
HandleStopFunction · 0.70
HandleRestartFunction · 0.70
CheckExistFunction · 0.70
CheckActiveFunction · 0.70
CheckEnableFunction · 0.70
GetServicePathFunction · 0.70

Calls 5

NewFunction · 0.70
loadProcessedNameFunction · 0.70
loadFromPredefinedFunction · 0.70
NameMethod · 0.65
IsExistMethod · 0.65

Tested by

no test coverage detected