@@ -3,9 +3,8 @@ package config
3
3
import (
4
4
"encoding/json"
5
5
"errors"
6
- "os"
7
-
8
6
log "github.com/sirupsen/logrus"
7
+ "os"
9
8
10
9
"github.com/qa-dev/jsonwire-grid/pool/metrics"
11
10
)
@@ -20,12 +19,14 @@ type Config struct {
20
19
21
20
// Grid general settings
22
21
type Grid struct {
23
- ClientType string `json:"client_type"`
24
- Port int `json:"port"`
25
- StrategyList []Strategy `json:"strategy_list"`
26
- BusyNodeDuration string `json:"busy_node_duration"` // duration string format ex. 12m, see time.ParseDuration()
22
+ ClientType string `json:"client_type"`
23
+ Port int `json:"port"`
24
+ StrategyList []Strategy `json:"strategy_list"`
25
+ // duration string format ex. 12m, see time.ParseDuration()
26
+ BusyNodeDuration string `json:"busy_node_duration"`
27
27
// todo: выпилить и сделать равным дедлайну http запроса
28
- ReservedDuration string `json:"reserved_node_duration"` // duration string format ex. 12m, see time.ParseDuration()
28
+ ReservedDuration string `json:"reserved_node_duration"`
29
+ FixNodeTimeout string `json:"fix_node_timeout"`
29
30
}
30
31
31
32
// Strategy - Describes the algorithm of node selection.
@@ -63,9 +64,19 @@ type Statsd struct {
63
64
CapabilitiesList []metrics.CapabilitiesSelector `json:"selectors"`
64
65
}
65
66
66
- // New - Constructor of config.
67
+ // New - Constructor of config with default values
67
68
func New () * Config {
68
- return & Config {}
69
+ return & Config {Logger : Logger {Level : "debug" },
70
+ DB : DB {Implementation : "local" },
71
+ Grid : Grid {
72
+ ClientType : "selenium" ,
73
+ Port : 4444 ,
74
+ StrategyList : []Strategy {{Type : "persistent" }},
75
+ ReservedDuration : "5m" ,
76
+ BusyNodeDuration : "15m" ,
77
+ FixNodeTimeout : "5m" ,
78
+ },
79
+ }
69
80
}
70
81
71
82
// LoadFromFile - config loader from json file.
0 commit comments