mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-10-18 21:34:35 +08:00
Initial commit, pt. 6
This commit is contained in:
@@ -126,12 +126,22 @@ func GetPlatformConfig[T any, S StreamProfile](
|
||||
logger.Debugf(ctx, "config '%s' was not found in cfg: %#+v", id, cfg)
|
||||
return nil
|
||||
}
|
||||
|
||||
return ConvertPlatformConfig[T, S](ctx, platCfg, id)
|
||||
}
|
||||
|
||||
func ConvertPlatformConfig[T any, S StreamProfile](
|
||||
ctx context.Context,
|
||||
platCfg *AbstractPlatformConfig,
|
||||
id PlatformName,
|
||||
) *PlatformConfig[T, S] {
|
||||
platCfgCfg, ok := platCfg.Config.(*T)
|
||||
if !ok {
|
||||
var zeroValue T
|
||||
logger.Errorf(ctx, "unable to get the config: expected type '%T', but received type '%T'", zeroValue, platCfg.Config)
|
||||
return nil
|
||||
}
|
||||
|
||||
return &PlatformConfig[T, S]{
|
||||
Config: *platCfgCfg,
|
||||
StreamProfiles: GetStreamProfiles[S](platCfg.StreamProfiles),
|
||||
|
Reference in New Issue
Block a user