Added Config.DatabaseAddress

This allows the server to connect to a MySQL server in a different
machine.
This commit is contained in:
Tarcisio Gruppi
2019-01-11 15:13:42 -02:00
parent 291538e341
commit c407945109
3 changed files with 20 additions and 17 deletions

View File

@@ -1,15 +1,16 @@
package types
type Config struct {
WebUrl string
Port int
ApiPrefix string
KeyFile string
CertFile string
Database string
User string
Password string
SendgridKey string
SendgridEmail string
SendgridSender string
WebUrl string
Port int
ApiPrefix string
KeyFile string
CertFile string
DatabaseAddress string
Database string
User string
Password string
SendgridKey string
SendgridEmail string
SendgridSender string
}

View File

@@ -2,16 +2,17 @@ package main
import (
"encoding/json"
"log"
"net/http"
"os"
"strconv"
"github.com/openaccounting/oa-server/core/api"
"github.com/openaccounting/oa-server/core/auth"
"github.com/openaccounting/oa-server/core/model"
"github.com/openaccounting/oa-server/core/model/db"
"github.com/openaccounting/oa-server/core/model/types"
"github.com/openaccounting/oa-server/core/util"
"log"
"net/http"
"os"
"strconv"
//"fmt"
)
@@ -31,7 +32,7 @@ func main() {
log.Fatal(err)
}
connectionString := config.User + ":" + config.Password + "@/" + config.Database
connectionString := config.User + ":" + config.Password + "@" + config.DatabaseAddress + "/" + config.Database
db, err := db.NewDB(connectionString)