Skip to content

Commit

Permalink
Use pointer for cost config (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Jan 4, 2024
1 parent 204a8a4 commit 76a2f23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/config/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type ServiceConfig struct {
PrometheusPort int `yaml:"prometheus_port"` // prometheus handler port
DebugHandlerPort int `yaml:"debug_handler_port"` // egress debug handler port

CPUCostConfig `yaml:"cpu_cost"` // CPU costs for the different egress types
*CPUCostConfig `yaml:"cpu_cost"` // CPU costs for the different egress types
}

type CPUCostConfig struct {
Expand All @@ -69,7 +69,8 @@ func NewServiceConfig(confString string) (*ServiceConfig, error) {
ApiSecret: os.Getenv("LIVEKIT_API_SECRET"),
WsUrl: os.Getenv("LIVEKIT_WS_URL"),
},
TemplatePort: defaultTemplatePort,
TemplatePort: defaultTemplatePort,
CPUCostConfig: &CPUCostConfig{},
}
if confString != "" {
if err := yaml.Unmarshal([]byte(confString), conf); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/stats/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

type Monitor struct {
cpuCostConfig config.CPUCostConfig
cpuCostConfig *config.CPUCostConfig

promCPULoad prometheus.Gauge
promProcCPULoad *prometheus.GaugeVec
Expand Down

0 comments on commit 76a2f23

Please sign in to comment.