-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathcfg.go
More file actions
70 lines (58 loc) · 1.47 KB
/
Copy pathcfg.go
File metadata and controls
70 lines (58 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package core
import (
"time"
"github.com/kodefluence/monorepo/db"
)
type AppLoader interface {
Compile(configPath string) (AppConfig, error)
}
type DatabaseLoader interface {
Compile(configPath string) (map[string]DatabaseConfig, error)
}
type PluginLoader interface {
Compile(pluginPath string) (PluginBearer, error)
}
type PluginBearer interface {
ConfigExists(pluginName string) bool
PluginVersion(pluginName string) (string, error)
DecodeConfig(pluginName string, target interface{}) error
ForEach(callbackFunc func(pluginName string) error)
Length() int
}
type DatabaseConfig interface {
Driver() string
DBHost() string
DBPort() (int, error)
DBUsername() string
DBPassword() string
DBDatabase() string
DBConnectionMaxLifetime() (time.Duration, error)
DBMaxIddleConn() (int, error)
DBMaxOpenConn() (int, error)
Dump() string
}
type DatabaseBearer interface {
Database(dbName string) (db.DB, DatabaseConfig, error)
}
type AppConfig interface {
Port() int
BasicAuthUsername() string
BasicAuthPassword() string
ProxyHost() string
UpstreamTimeout() time.Duration
MaxRequestBodySize() int64
PluginExists(pluginName string) bool
Plugins() []string
AutoMigrate() bool
Dump() string
}
type MetricConfig interface {
Interface() string
}
type AppBearer interface {
Config() AppConfig
DownStreamPlugins() []DownStreamPlugin
InjectDownStreamPlugin(InjectedDownStreamPlugin DownStreamPlugin)
SetMetricProvider(metricProvider Metric)
MetricProvider() (Metric, error)
}