Skip to content

Commit a62dce1

Browse files
committed
adapters. fix state on branch.
1 parent 7a0fe32 commit a62dce1

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

.env

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
DEBUG=true
22
SERVER_LISTEN_NETWORK=tcp4
33
SERVER_LISTEN_ADDR=:3060
4-
BOLTDB_PATH=./inventory.db
4+
BOLTDB_PATH=./dev/inventory.db
5+
DEVICE_DB_PATH=./dev/browscap.ini
6+
GEO_DB_PATH=./dev/GeoLite2-City.mmdb
7+
DSP_ADAPTERS_CONFIG_FILES_PATH=./dsp-configs

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.bin
2+
dev

cmd/app/main.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import (
2121
)
2222

2323
type Config struct {
24-
Debug bool `env:"DEBUG"`
25-
ServerListeNetwork string `env:"SERVER_LISTEN_NETWORK,required"`
26-
ServerListenAddr string `env:"SERVER_LISTEN_ADDR,required"`
27-
BoltDBPath string `env:"BOLTDB_PATH,required"`
28-
DeviceDBPath string `env:"DEVICE_DB_PATH,required"`
29-
GeoDBPath string `env:"GEO_DB_PATH,required"`
30-
DSPAdaptersConfigFilePath string `env:"DSP_ADPATERS_CONFIG_FILE_PATH, required"`
24+
Debug bool `env:"DEBUG"`
25+
ServerListeNetwork string `env:"SERVER_LISTEN_NETWORK,required"`
26+
ServerListenAddr string `env:"SERVER_LISTEN_ADDR,required"`
27+
BoltDBPath string `env:"BOLTDB_PATH,required"`
28+
DeviceDBPath string `env:"DEVICE_DB_PATH,required"`
29+
GeoDBPath string `env:"GEO_DB_PATH,required"`
30+
DSPAdaptersConfigFilesPath string `env:"DSP_ADAPTERS_CONFIG_FILES_PATH,required"`
3131
}
3232

3333
func main() {
@@ -96,7 +96,7 @@ func main() {
9696

9797
enabledDSPAdapters := []interfaces.DSPName{}
9898
dspConfigProvider, err := default_config_provider.New(
99-
config.DSPAdaptersConfigFilePath,
99+
config.DSPAdaptersConfigFilesPath,
100100
l,
101101
)
102102
if err != nil {
@@ -112,7 +112,7 @@ func main() {
112112
dspConfigProvider,
113113
)
114114
if err != nil {
115-
l.Errorf("app exit", err.Error())
115+
l.Errorf("app exit: %s\n", err.Error())
116116
os.Exit(1)
117117
}
118118

dsp-configs/demo-dsp-1.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name":"Demo DSP #1",
3+
"enpoint":"http:/127.0.0.1:8060/rtb"
4+
}

internal/application/interfaces/dsp_adapter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ type DSPAdapter interface {
1818
}
1919

2020
type DSPAdapterConfig struct {
21-
Name DSPName
22-
Endpoint string
21+
Name DSPName `json:"name"`
22+
Endpoint string `json:"endpoint"`
2323
}
2424

2525
type NewDSPAdapter func(DSPAdapterConfig) (DSPAdapter, error)

inventory.db

-32 KB
Binary file not shown.

0 commit comments

Comments
 (0)