File tree 4 files changed +23
-30
lines changed
4 files changed +23
-30
lines changed Original file line number Diff line number Diff line change @@ -97,21 +97,6 @@ objects:
97
97
spec :
98
98
containers :
99
99
- env :
100
- - name : DB_USERNAME
101
- valueFrom :
102
- secretKeyRef :
103
- name : my-database-secret
104
- key : user
105
- - name : DB_PASSWORD
106
- valueFrom :
107
- secretKeyRef :
108
- name : my-database-secret
109
- key : password
110
- - name : DB_HOST
111
- valueFron :
112
- secretKeyRef :
113
- name : my-database-secret
114
- key : host
115
100
readinessProbe :
116
101
httpGet :
117
102
path : /api/fruits
@@ -172,14 +157,3 @@ objects:
172
157
labels :
173
158
project : golang-http-crud
174
159
version : ' ${RELEASE_VERSION}'
175
- - apiVersion : v1
176
- kind : Secret
177
- metadata :
178
- name : my-database-secret
179
- labels :
180
- app : golang-http-crud
181
- version : ' ${RELEASE_VERSION}'
182
- stringData :
183
- user : postgres
184
- password : mysecretpassword
185
- host : my-database
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ items:
13
13
spec :
14
14
tags :
15
15
- annotations :
16
- openshift.io/imported-from : postgresql /postgresql:9.6
16
+ openshift.io/imported-from : centos /postgresql-96-centos7
17
17
from :
18
18
kind : DockerImage
19
- name : postgresql /postgresql:9.6
19
+ name : centos /postgresql-96-centos7
20
20
generation : null
21
21
importPolicy : {}
22
22
name : latest
53
53
- env :
54
54
- name : POSTGRESQL_ADMIN_PASSWORD
55
55
value : mysecretpassword
56
- image : postgresql /postgresql:9.6
56
+ image : centos /postgresql-96-centos7
57
57
name : my-database
58
58
ports :
59
59
- containerPort : 5432
Original file line number Diff line number Diff line change
1
+ Golang CRUD Booster
2
+
3
+ #### Running Locally
4
+
5
+ First, install the dependencies
6
+ ` go get `
7
+
8
+ The web app requires Postgres DB. If you have docker installed, you can run the
9
+ following command to start a new Postgres container
10
+
11
+ ` docker run -e POSTGRESQL_ADMIN_PASSWORD=mysecretpassword -d -p 5432:5432 centos/postgresql-96-centos7 `
12
+
13
+ In this example, the database user is ` postgres ` , the password is ` mysecretpassword ` and the database is ` postgres `
14
+
15
+ You can then start the application like this:
16
+
17
+ ` go build && ./golang-http-crud `
18
+
19
+ Then go to http://localhost:8080
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
13
13
)
14
14
15
15
func main () {
16
- pgHost := getEnv ("DB_HOST " , "localhost" )
16
+ pgHost := getEnv ("MY_DATABASE_SERVICE_HOST " , "localhost" )
17
17
pgPort := getEnv ("DB_PORT" , "5432" )
18
18
pgUser := getEnv ("DB_USERNAME" , "postgres" )
19
19
pgDBname := getEnv ("DB_DBNAME" , "postgres" )
You can’t perform that action at this time.
0 commit comments