Skip to content
This repository was archived by the owner on May 19, 2020. It is now read-only.

Commit 9c37f5b

Browse files
authored
Merge pull request #1290 from 18F/pdb/rm_redis_service
Remove redis service pieces
2 parents 574f0e1 + 94864f2 commit 9c37f5b

7 files changed

Lines changed: 4 additions & 271 deletions

File tree

Gopkg.lock

Lines changed: 1 addition & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

devtools/docker-setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ navigate to `http://localhost:8001` and see the testing server.
3939
## Full Setup
4040

4141
After running the Full Setup instructions, you will have a
42-
local Cloud Foundry deployment (with UAA), the dashboard, a redis service
43-
instance, mailcatcher for testing e-mails, and npm watch running so that you can
42+
local Cloud Foundry deployment (with UAA), the dashboard,
43+
mailcatcher for testing e-mails, and npm watch running so that you can
4444
automatically recompile your frontend changes.
4545

4646
### Full Setup: Requirements

glide.lock

Lines changed: 0 additions & 151 deletions
This file was deleted.

glide.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

helpers/settings.go

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77
"errors"
88
"fmt"
99
"net/http"
10-
"net/url"
11-
"os"
1210

1311
"github.com/cloudfoundry-community/go-cfenv"
1412
"github.com/gorilla/sessions"
@@ -179,70 +177,3 @@ func (s *Settings) InitSettings(envVars *env.VarSet, app *cfenv.App) (retErr err
179177
s.TICSecret = envVars.String(TICSecretEnvVar, "")
180178
return nil
181179
}
182-
183-
func getRedisSettings(env *cfenv.App) (string, string, error) {
184-
var err error
185-
// Try to read directly from REDIS_URI first.
186-
uri := os.Getenv("REDIS_URI")
187-
if uri == "" {
188-
// If no direct REDIS_URI, parse VCAP_SERVICES
189-
uri, err = getRedisService(env)
190-
}
191-
// If nothing worked so far, default to localhost
192-
if uri == "" || err != nil {
193-
uri = "redis://localhost:6379"
194-
}
195-
196-
u, err := url.Parse(uri)
197-
if err != nil {
198-
return "", "", err
199-
}
200-
201-
password := ""
202-
if u.User != nil {
203-
password, _ = u.User.Password()
204-
}
205-
206-
return u.Host, password, nil
207-
}
208-
209-
func getRedisService(env *cfenv.App) (string, error) {
210-
if env == nil {
211-
return "", errors.New("Empty Cloud Foundry environment")
212-
}
213-
services, err := env.Services.WithTag("redis")
214-
if err != nil {
215-
return "", err
216-
}
217-
if len(services) == 0 {
218-
return "", errors.New(`Could not find service with tag "redis"`)
219-
}
220-
uri, ok := services[0].Credentials["uri"].(string)
221-
if !ok {
222-
if uri, err = getRedisURIFromParts(services[0]); err == nil {
223-
return uri, nil
224-
}
225-
return "", errors.New("Could not parse redis uri")
226-
}
227-
return uri, nil
228-
}
229-
230-
// TODO: Delete after east-west is retired
231-
func getRedisURIFromParts(service cfenv.Service) (string, error) {
232-
host, ok := service.Credentials["hostname"].(string)
233-
if !ok {
234-
return "", errors.New(`Could not find "host" key`)
235-
}
236-
237-
port, ok := service.Credentials["port"].(string)
238-
if !ok {
239-
return "", errors.New(`Could not find "port" key`)
240-
}
241-
242-
password, ok := service.Credentials["password"].(string)
243-
if !ok {
244-
return "", errors.New(`Could not find "password" key`)
245-
}
246-
247-
return fmt.Sprintf("redis://:%s@%s:%s", password, host, port), nil
248-
}

helpers/testhelpers/docker/docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func skipIfNoDocker(t *testing.T) {
5252
}
5353
}
5454

55-
// CreateTestMailCatcher creates a actual redis instance with docker.
55+
// CreateTestMailCatcher creates a actual MailCatcher instance with docker.
5656
// Useful for unit tests.
5757
func CreateTestMailCatcher(t *testing.T) (string, string, string, func()) {
5858
skipIfNoDocker(t)

manifests/manifest-base.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ buildpack: go_buildpack
33
memory: 256M
44
services:
55
- dashboard-ups
6-
- dashboard-redis
76
env:
87
SECURE_COOKIES: true
98
GA_TRACKING_ID: UA-48605964-34

0 commit comments

Comments
 (0)