Update the README / dev process explanation
This commit is contained in:
parent
827ab41df5
commit
7dd1eba942
23
README.md
23
README.md
@ -7,8 +7,29 @@ Just run the docker-compose file to create the database.
|
|||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Dev
|
||||||
|
|
||||||
## Run the tests
|
### Connect to the database
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -it --rm --link canape_postgresql_dev:postgres postgres:9.5 psql -h postgres -U test
|
||||||
|
```
|
||||||
|
|
||||||
|
Then connect to the database you wanna check :
|
||||||
|
|
||||||
|
```
|
||||||
|
\c dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Apply the migrations
|
||||||
|
|
||||||
|
```
|
||||||
|
migrate -url 'postgres://test:test@127.0.0.1:5432/dev?sslmode=disable' -path ./sql up
|
||||||
|
migrate -url 'postgres://test:test@127.0.0.1:5432/dev?sslmode=disable' -path ./sqltest up
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Run the tests
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -5,5 +5,7 @@ postgresql:
|
|||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD=test
|
- POSTGRES_PASSWORD=test
|
||||||
- POSTGRES_USER=test
|
- POSTGRES_USER=test
|
||||||
|
volumes:
|
||||||
|
- .:/docker-entrypoint-initdb.d/
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:5432:5432
|
- 127.0.0.1:5432:5432
|
1
docker/init.sql
Normal file
1
docker/init.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
CREATE DATABASE dev;
|
2
main.go
2
main.go
@ -23,7 +23,7 @@ func (b *UserBackend) Get(username string) (auth.User, error) {
|
|||||||
func main() {
|
func main() {
|
||||||
log := logrus.NewEntry(logrus.New())
|
log := logrus.NewEntry(logrus.New())
|
||||||
|
|
||||||
pgdsn := "postgres://test:test@127.0.0.1:5432/test?sslmode=disable"
|
pgdsn := "postgres://test:test@127.0.0.1:5432/dev?sslmode=disable"
|
||||||
db, err := sqlx.Connect("postgres", pgdsn)
|
db, err := sqlx.Connect("postgres", pgdsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panic(err)
|
log.Panic(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user