mirror of
https://github.com/compute-blade-community/compute-blade-agent.git
synced 2026-04-21 17:45:43 +02:00
fix: smart fan unit improvements (#31)
* fix: load config from /etc/computeblade-agent Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com> * fix: fan target percent reporting Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com> * fix: fancontroller default config & update interval Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com> * chore: update Readme Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com> --------- Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com>
This commit is contained in:
@@ -41,8 +41,8 @@ fan_controller:
|
||||
# For now, this is only supporting a two-step configuration.
|
||||
steps:
|
||||
- temperature: 45
|
||||
speed: 40
|
||||
percent: 40
|
||||
- temperature: 55
|
||||
speed: 80
|
||||
percent: 80
|
||||
# Critical temperature threshold
|
||||
critical_temperature_threshold: 60
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
@@ -14,8 +13,6 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/spf13/viper"
|
||||
bladeapiv1alpha1 "github.com/xvzf/computeblade-agent/api/bladeapi/v1alpha1"
|
||||
@@ -25,22 +22,22 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// embed default configuration
|
||||
|
||||
//go:embed default-config.yaml
|
||||
var defaultConfig []byte
|
||||
|
||||
func main() {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
// Setup configuration
|
||||
viper.SetConfigType("yaml")
|
||||
|
||||
// auto-bind environment variables
|
||||
viper.SetEnvPrefix("BLADE")
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.AutomaticEnv()
|
||||
viper.SetConfigName("config")
|
||||
viper.SetConfigType("yaml")
|
||||
viper.AddConfigPath("/etc/computeblade-agent")
|
||||
|
||||
// Load potential file configs
|
||||
if err := viper.ReadConfig(bytes.NewBuffer(defaultConfig)); err != nil {
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user