feat: implement initial configuration and gstreamer pipeline setup
This commit is contained in:
parent
d672f04be2
commit
4a6f36f1ef
9 changed files with 566 additions and 50 deletions
32
internal/config/confgi.go
Normal file
32
internal/config/confgi.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package config
|
||||
|
||||
import "github.com/ilyakaznacheev/cleanenv"
|
||||
|
||||
type Config struct {
|
||||
Debug bool `toml:"debug" env:"DEBUG" env-default:"false"`
|
||||
Pipeline Pipeline `toml:"pipeline"`
|
||||
Outputs []Output `toml:"outputs"`
|
||||
}
|
||||
|
||||
type Output struct {
|
||||
Type string `toml:"type" env:"OUTPUT_TYPE"`
|
||||
Target string `toml:"target" env:"OUTPUT_TARGET"`
|
||||
}
|
||||
|
||||
type Pipeline struct {
|
||||
Width int `toml:"width" env:"PIPELINE_WIDTH" env-default:"50"`
|
||||
Height int `toml:"height" env:"PIPELINE_HEIGHT" env-default:"50"`
|
||||
}
|
||||
|
||||
func LoadConfig(path string) (*Config, error) {
|
||||
var cfg Config
|
||||
err := cleanenv.ReadConfig(path, &cfg)
|
||||
if err != nil {
|
||||
// It's often useful to ignore "file not found" errors if you want
|
||||
// to allow configuration purely via environment variables.
|
||||
// However, the specific behavior depends on the application's needs.
|
||||
// For now, we'll return the error.
|
||||
return nil, err
|
||||
}
|
||||
return &cfg, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue