internal/testplanet: add missing consoleserver.Config (#2269)

This commit is contained in:
Egon Elbre 2019-06-20 23:27:36 +03:00 committed by Stefan Benten
parent daf166d423
commit d435d4859d
2 changed files with 29 additions and 14 deletions

View File

@ -0,0 +1,20 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information
package testplanet
import (
"runtime"
"strings"
)
var developmentRoot string
func init() {
_, filename, _, ok := runtime.Caller(0)
if !ok {
return
}
developmentRoot = strings.TrimSuffix(filename, "/internal/testplanet/dir.go")
}

View File

@ -13,7 +13,6 @@ import (
"net"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"
@ -54,6 +53,7 @@ import (
"storj.io/storj/satellite/vouchers"
"storj.io/storj/storagenode"
"storj.io/storj/storagenode/collector"
"storj.io/storj/storagenode/console/consoleserver"
"storj.io/storj/storagenode/monitor"
"storj.io/storj/storagenode/orders"
"storj.io/storj/storagenode/piecestore"
@ -511,14 +511,17 @@ func (planet *Planet) newSatellites(count int) ([]*satellite.Peer, error) {
SMTPServerAddress: "smtp.mail.test:587",
From: "Labs <storj@mail.test>",
AuthType: "simulate",
TemplatePath: filepath.Join(developmentRoot, "web/satellite/static/emails"),
},
Console: consoleweb.Config{
Address: "127.0.0.1:0",
StaticDir: filepath.Join(developmentRoot, "web/satellite"),
PasswordCost: console.TestPasswordCost,
AuthTokenSecret: "my-suppa-secret-key",
},
Marketing: marketingweb.Config{
Address: "127.0.0.1:0",
Address: "127.0.0.1:0",
StaticDir: filepath.Join(developmentRoot, "web/marketing"),
},
Vouchers: vouchers.Config{
Expiration: 30,
@ -529,18 +532,6 @@ func (planet *Planet) newSatellites(count int) ([]*satellite.Peer, error) {
planet.config.Reconfigure.Satellite(log, i, &config)
}
// TODO: find source file, to set static path
_, filename, _, ok := runtime.Caller(0)
if !ok {
return xs, errs.New("no caller information")
}
storjRoot := strings.TrimSuffix(filename, "/internal/testplanet/planet.go")
// TODO: for development only
config.Marketing.StaticDir = filepath.Join(storjRoot, "web/marketing")
config.Console.StaticDir = filepath.Join(storjRoot, "web/satellite")
config.Mail.TemplatePath = filepath.Join(storjRoot, "web/satellite/static/emails")
verInfo := planet.NewVersionInfo()
peer, err := satellite.New(log, identity, db, &config, verInfo)
@ -633,6 +624,10 @@ func (planet *Planet) newStorageNodes(count int, whitelistedSatelliteIDs []strin
Collector: collector.Config{
Interval: time.Minute,
},
Console: consoleserver.Config{
Address: "127.0.0.1:0",
StaticDir: filepath.Join(developmentRoot, "web/operator/"),
},
Storage2: piecestore.Config{
Sender: orders.SenderConfig{
Interval: time.Hour,