forked from cerc-io/ipld-eth-server
Database config
This commit is contained in:
parent
6805d3ea29
commit
bd12149594
1
Gopkg.lock
generated
1
Gopkg.lock
generated
@ -542,7 +542,6 @@
|
|||||||
"github.com/ethereum/go-ethereum/ethdb",
|
"github.com/ethereum/go-ethereum/ethdb",
|
||||||
"github.com/ethereum/go-ethereum/p2p",
|
"github.com/ethereum/go-ethereum/p2p",
|
||||||
"github.com/ethereum/go-ethereum/p2p/discv5",
|
"github.com/ethereum/go-ethereum/p2p/discv5",
|
||||||
"github.com/ethereum/go-ethereum/params",
|
|
||||||
"github.com/ethereum/go-ethereum/rlp",
|
"github.com/ethereum/go-ethereum/rlp",
|
||||||
"github.com/ethereum/go-ethereum/rpc",
|
"github.com/ethereum/go-ethereum/rpc",
|
||||||
"github.com/hashicorp/golang-lru",
|
"github.com/hashicorp/golang-lru",
|
||||||
|
4
Makefile
4
Makefile
@ -70,7 +70,8 @@ build: dep
|
|||||||
HOST_NAME = localhost
|
HOST_NAME = localhost
|
||||||
PORT = 5432
|
PORT = 5432
|
||||||
NAME =
|
NAME =
|
||||||
CONNECT_STRING=postgresql://$(HOST_NAME):$(PORT)/$(NAME)?sslmode=disable
|
USER = vulcanize
|
||||||
|
CONNECT_STRING=postgresql://$(USER)@$(HOST_NAME):$(PORT)/$(NAME)?sslmode=disable
|
||||||
|
|
||||||
# Parameter checks
|
# Parameter checks
|
||||||
## Check that DB variables are provided
|
## Check that DB variables are provided
|
||||||
@ -79,6 +80,7 @@ checkdbvars:
|
|||||||
test -n "$(HOST_NAME)" # $$HOST_NAME
|
test -n "$(HOST_NAME)" # $$HOST_NAME
|
||||||
test -n "$(PORT)" # $$PORT
|
test -n "$(PORT)" # $$PORT
|
||||||
test -n "$(NAME)" # $$NAME
|
test -n "$(NAME)" # $$NAME
|
||||||
|
test -n "$(USER)" # $$USER
|
||||||
@echo $(CONNECT_STRING)
|
@echo $(CONNECT_STRING)
|
||||||
|
|
||||||
## Check that the migration variable (id/timestamp) is provided
|
## Check that the migration variable (id/timestamp) is provided
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[database]
|
[database]
|
||||||
name = "vulcanize_public"
|
name = "vulcanize_public"
|
||||||
hostname = "localhost"
|
hostname = "localhost"
|
||||||
port = 5432
|
port = 3333
|
||||||
|
|
||||||
[client]
|
[client]
|
||||||
ipcPath = ""
|
ipcPath = ""
|
||||||
|
@ -128,7 +128,13 @@ func (m *manager) fixAndRun(path string) error {
|
|||||||
return errors.New(fmt.Sprintf("version fixing for plugin migrations at %s failed: %s", path, err.Error()))
|
return errors.New(fmt.Sprintf("version fixing for plugin migrations at %s failed: %s", path, err.Error()))
|
||||||
}
|
}
|
||||||
// Run the copied migrations with goose
|
// Run the copied migrations with goose
|
||||||
pgStr := fmt.Sprintf("postgres://%s:%d/%s?sslmode=disable", m.DBConfig.Hostname, m.DBConfig.Port, m.DBConfig.Name)
|
var pgStr string
|
||||||
|
if len(m.DBConfig.User) > 0 && len(m.DBConfig.Password) > 0 {
|
||||||
|
pgStr = fmt.Sprintf("postgresql://%s:%s@%s:%d/%s?sslmode=disable",
|
||||||
|
m.DBConfig.User, m.DBConfig.Password, m.DBConfig.Hostname, m.DBConfig.Port, m.DBConfig.Name)
|
||||||
|
} else {
|
||||||
|
pgStr = fmt.Sprintf("postgres://%s:%d/%s?sslmode=disable", m.DBConfig.Hostname, m.DBConfig.Port, m.DBConfig.Name)
|
||||||
|
}
|
||||||
cmd = exec.Command("goose", "postgres", pgStr, "up")
|
cmd = exec.Command("goose", "postgres", pgStr, "up")
|
||||||
cmd.Dir = m.tmpMigDir
|
cmd.Dir = m.tmpMigDir
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
|
Loading…
Reference in New Issue
Block a user