feat: implement initial configuration and gstreamer pipeline setup

This commit is contained in:
Garionion 2025-04-09 18:10:34 +02:00
parent d672f04be2
commit 4a6f36f1ef
Signed by: garionion
SSH key fingerprint: SHA256:6uQQGh4dHIdYnrR+qeLdgx5SDmbttGp2HusA73563QA
9 changed files with 566 additions and 50 deletions

32
internal/config/confgi.go Normal file
View 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
}