You've already forked openaccounting-server
mirror of
https://github.com/openaccounting/oa-server.git
synced 2025-12-09 00:50:59 +13:00
Added Config.DatabaseAddress
This allows the server to connect to a MySQL server in a different machine.
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
"ApiPrefix": "",
|
"ApiPrefix": "",
|
||||||
"KeyFile": "",
|
"KeyFile": "",
|
||||||
"CertFile": "",
|
"CertFile": "",
|
||||||
|
"DatabaseAddress": "",
|
||||||
"Database": "openaccounting",
|
"Database": "openaccounting",
|
||||||
"User": "openaccounting",
|
"User": "openaccounting",
|
||||||
"Password": "openaccounting",
|
"Password": "openaccounting",
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
WebUrl string
|
WebUrl string
|
||||||
Port int
|
Port int
|
||||||
ApiPrefix string
|
ApiPrefix string
|
||||||
KeyFile string
|
KeyFile string
|
||||||
CertFile string
|
CertFile string
|
||||||
Database string
|
DatabaseAddress string
|
||||||
User string
|
Database string
|
||||||
Password string
|
User string
|
||||||
SendgridKey string
|
Password string
|
||||||
SendgridEmail string
|
SendgridKey string
|
||||||
SendgridSender string
|
SendgridEmail string
|
||||||
|
SendgridSender string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/openaccounting/oa-server/core/api"
|
"github.com/openaccounting/oa-server/core/api"
|
||||||
"github.com/openaccounting/oa-server/core/auth"
|
"github.com/openaccounting/oa-server/core/auth"
|
||||||
"github.com/openaccounting/oa-server/core/model"
|
"github.com/openaccounting/oa-server/core/model"
|
||||||
"github.com/openaccounting/oa-server/core/model/db"
|
"github.com/openaccounting/oa-server/core/model/db"
|
||||||
"github.com/openaccounting/oa-server/core/model/types"
|
"github.com/openaccounting/oa-server/core/model/types"
|
||||||
"github.com/openaccounting/oa-server/core/util"
|
"github.com/openaccounting/oa-server/core/util"
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
//"fmt"
|
//"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionString := config.User + ":" + config.Password + "@/" + config.Database
|
connectionString := config.User + ":" + config.Password + "@" + config.DatabaseAddress + "/" + config.Database
|
||||||
|
|
||||||
db, err := db.NewDB(connectionString)
|
db, err := db.NewDB(connectionString)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user