| package features |
| |
| import ( |
| "fmt" |
| ) |
| |
| // FeatureConfig holds all the configuration values for all the feature flags. |
| type FeatureConfig struct { |
| PerGPULabelFeatureFlag bool |
| } |
| |
| // InitFlags initializes the feature flags and return a FeatureConfig instance. |
| func InitFlags(cosGPUConfigJsonPath string) (*FeatureConfig, error) { |
| gpuConfig, err := ReadCOSGPUConfig(cosGPUConfigJsonPath) |
| if err != nil { |
| return nil, fmt.Errorf("cannot read cos gpu config json file: %s with error: %v.", cosGPUConfigJsonPath, err) |
| } |
| // PerGPULabelFeatureFlag is enabled when `use-proto` is true in the cos-gpu-config.json |
| var featureConfig = &FeatureConfig{ |
| PerGPULabelFeatureFlag: gpuConfig.UseProto, |
| } |
| return featureConfig, nil |
| } |