Compare commits
No commits in common. "0579b3e97dbe70fedbc0722528870947aec1509a" and "0c2c136413511f9e29731bb5fd4f7b22c892e54f" have entirely different histories.
0579b3e97d
...
0c2c136413
|
@ -1,9 +1,11 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 20200906-2
|
||||||
|
|
||||||
|
- Add HDMI on/off command for help with ensuring screen is on OR off at boot since systemd timers won't re-run on boot
|
||||||
|
|
||||||
## 20200906-1
|
## 20200906-1
|
||||||
|
|
||||||
- Build bug fixes
|
|
||||||
- Add HDMI on/off command for help with ensuring screen is on OR off at boot since systemd timers won't re-run on boot
|
|
||||||
- Update tools to watch for config changes and restart if config has changed
|
- Update tools to watch for config changes and restart if config has changed
|
||||||
|
|
||||||
## 20200905-4
|
## 20200905-4
|
||||||
|
|
|
@ -20,7 +20,7 @@ const (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Load the config file
|
// Load the config file
|
||||||
pfConfig, configFileProvider := config.LoadConfig(false)
|
pfConfig, configFileProvider := config.LoadConfig()
|
||||||
|
|
||||||
// Watch for config changes and re-load config if needed
|
// Watch for config changes and re-load config if needed
|
||||||
configFileProvider.Watch(func(event interface{}, err error) {
|
configFileProvider.Watch(func(event interface{}, err error) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ func main() {
|
||||||
|
|
||||||
log.Print("Loading config")
|
log.Print("Loading config")
|
||||||
// Load the config file
|
// Load the config file
|
||||||
pfConfig, configFileProvider := config.LoadConfig(false)
|
pfConfig, configFileProvider := config.LoadConfig()
|
||||||
log.Printf("%v", pfConfig)
|
log.Printf("%v", pfConfig)
|
||||||
pfConfig.Print()
|
pfConfig.Print()
|
||||||
|
|
||||||
|
|
|
@ -2,22 +2,22 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"os/exec"
|
||||||
|
|
||||||
"git.kemonine.info/PiFrame/config"
|
"git.kemonine.info/PiFrame/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CMD_VCGENCMD = "/opt/vc/bin//vcgencmd"
|
CMD_VCGENCMD = "/opt/vc/bin//vcgencmd"
|
||||||
CMD_VCGENCMD_DISPLAY_POWER = "display_power"
|
CMD_VCGENCMD_DISPLAY_POWER = "display_power"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Load the config file
|
// Load the config file
|
||||||
pfConfig, _ := config.LoadConfig(false)
|
pfConfig, _ := config.LoadConfig()
|
||||||
pfConfig.Print()
|
pfConfig.Print()
|
||||||
|
|
||||||
// Read config values
|
// Read config values
|
||||||
|
|
|
@ -18,7 +18,7 @@ const (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Load the config file
|
// Load the config file
|
||||||
pfConfig, configFileProvider := config.LoadConfig(false)
|
pfConfig, configFileProvider := config.LoadConfig()
|
||||||
|
|
||||||
// Watch for config changes and re-load config if needed
|
// Watch for config changes and re-load config if needed
|
||||||
configFileProvider.Watch(func(event interface{}, err error) {
|
configFileProvider.Watch(func(event interface{}, err error) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
kfile "github.com/knadh/koanf/providers/file"
|
kfile "github.com/knadh/koanf/providers/file"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadConfig(errFatalOnMissing bool) (*koanf.Koanf, *kfile.File) {
|
func LoadConfig() (*koanf.Koanf, *kfile.File) {
|
||||||
// Main config variable
|
// Main config variable
|
||||||
var pfConfig = koanf.New(".")
|
var pfConfig = koanf.New(".")
|
||||||
|
|
||||||
|
@ -30,11 +30,7 @@ func LoadConfig(errFatalOnMissing bool) (*koanf.Koanf, *kfile.File) {
|
||||||
configFileProvider := kfile.Provider(CONFIG_FILE_PATH)
|
configFileProvider := kfile.Provider(CONFIG_FILE_PATH)
|
||||||
log.Print("========================================")
|
log.Print("========================================")
|
||||||
if err := pfConfig.Load(configFileProvider, toml.Parser()); err != nil {
|
if err := pfConfig.Load(configFileProvider, toml.Parser()); err != nil {
|
||||||
if errFatalOnMissing {
|
log.Fatalf("Error loading config : %s", err)
|
||||||
log.Fatalf("Error loading config : %s", err)
|
|
||||||
} else {
|
|
||||||
log.Printf("Error loading config : %s", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.Print("========================================")
|
log.Print("========================================")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue