Implemented epics read/write
This commit is contained in:
+19
-16
@@ -10,8 +10,7 @@ import (
|
||||
|
||||
type Config struct {
|
||||
Server ServerConfig `toml:"server"`
|
||||
EPICS EPICSConfig `toml:"datasource.epics"`
|
||||
Synthetic SyntheticConfig `toml:"datasource.synthetic"`
|
||||
Datasource DatasourceConfig `toml:"datasource"`
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
@@ -19,6 +18,16 @@ type ServerConfig struct {
|
||||
StorageDir string `toml:"storage_dir"`
|
||||
}
|
||||
|
||||
type DatasourceConfig struct {
|
||||
Stub StubConfig `toml:"stub"`
|
||||
EPICS EPICSConfig `toml:"epics"`
|
||||
Synthetic SyntheticConfig `toml:"synthetic"`
|
||||
}
|
||||
|
||||
type StubConfig struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
}
|
||||
|
||||
type EPICSConfig struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
CAAddrList string `toml:"ca_addr_list"`
|
||||
@@ -27,8 +36,7 @@ type EPICSConfig struct {
|
||||
}
|
||||
|
||||
type SyntheticConfig struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
DefinitionsFile string `toml:"definitions_file"`
|
||||
Enabled bool `toml:"enabled"`
|
||||
}
|
||||
|
||||
func Default() Config {
|
||||
@@ -37,12 +45,10 @@ func Default() Config {
|
||||
Listen: ":8080",
|
||||
StorageDir: "./interfaces",
|
||||
},
|
||||
EPICS: EPICSConfig{
|
||||
Enabled: true,
|
||||
},
|
||||
Synthetic: SyntheticConfig{
|
||||
Enabled: true,
|
||||
DefinitionsFile: "./synthetic.json",
|
||||
Datasource: DatasourceConfig{
|
||||
Stub: StubConfig{Enabled: true},
|
||||
EPICS: EPICSConfig{Enabled: true},
|
||||
Synthetic: SyntheticConfig{Enabled: true},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -71,16 +77,13 @@ func applyEnv(cfg *Config) {
|
||||
cfg.Server.StorageDir = v
|
||||
}
|
||||
if v := env("UOPI_EPICS_CA_ADDR_LIST"); v != "" {
|
||||
cfg.EPICS.CAAddrList = v
|
||||
cfg.Datasource.EPICS.CAAddrList = v
|
||||
}
|
||||
if v := env("UOPI_EPICS_ARCHIVE_URL"); v != "" {
|
||||
cfg.EPICS.ArchiveURL = v
|
||||
cfg.Datasource.EPICS.ArchiveURL = v
|
||||
}
|
||||
if v := env("UOPI_EPICS_CHANNEL_FINDER_URL"); v != "" {
|
||||
cfg.EPICS.ChannelFinderURL = v
|
||||
}
|
||||
if v := env("UOPI_SYNTHETIC_DEFINITIONS_FILE"); v != "" {
|
||||
cfg.Synthetic.DefinitionsFile = v
|
||||
cfg.Datasource.EPICS.ChannelFinderURL = v
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user