[v2.15] redis CRUD
This commit is contained in:
Родитель
3bde60e6cb
Коммит
28c60ef59a
|
@ -14,7 +14,7 @@ rbac:
|
|||
|
||||
image:
|
||||
repository: divyanshm/k8s-poolprovider
|
||||
tag: v2.14
|
||||
tag: v2.15
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
vsts:
|
||||
|
|
|
@ -68,7 +68,7 @@ spec:
|
|||
spec:
|
||||
serviceAccountName: pipelineprovider
|
||||
containers:
|
||||
- image: divyanshm/k8s-poolprovider:v2.14
|
||||
- image: divyanshm/k8s-poolprovider:v2.15
|
||||
name: k8s-poolprovider
|
||||
command: ["/app/main"]
|
||||
ports:
|
||||
|
|
23
main.go
23
main.go
|
@ -73,25 +73,12 @@ func StorageGetHandler(s Storage) http.HandlerFunc {
|
|||
|
||||
func StorageSetHandler(s Storage) http.HandlerFunc {
|
||||
return func(resp http.ResponseWriter, req *http.Request) {
|
||||
key := req.URL.Query()["key"]
|
||||
value := req.URL.Query()["value"]
|
||||
fmt.Fprintf(resp, "key is %s, value is %s", key[0], value[0]);
|
||||
if key == nil || key[0] == "" {
|
||||
key[0] = "fu"
|
||||
}
|
||||
key := "some sample key"
|
||||
value := "some sample value"
|
||||
|
||||
if value == nil || value[0] == "" {
|
||||
value[0] = "bar"
|
||||
}
|
||||
|
||||
err := s.Set(key[0], value[0])
|
||||
if err != nil {
|
||||
resp.WriteHeader(http.StatusInternalServerError)
|
||||
fmt.Fprintf(resp, "Error" + err.Error())
|
||||
return
|
||||
}
|
||||
resp.WriteHeader(http.StatusOK)
|
||||
fmt.Fprintf(resp, "Value set")
|
||||
s.Set(key, value)
|
||||
retrievedValue, _ := s.Get(key)
|
||||
fmt.Fprintf(resp, "All good. Retrieved %s", retrievedValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
1
redis.go
1
redis.go
|
@ -61,6 +61,7 @@ func (r *RedisStorage) Init() string {
|
|||
if err != nil {
|
||||
fmt.Println("worst_car_ever not found", err)
|
||||
}
|
||||
|
||||
return worst_car_ever
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче