Files
sender/internal/config/config.go
T
phoenixandphoenix 6e7b2cdee8 Update go (#17)
Reviewed-on: #17
Co-authored-by: phoenix <mail@kundeng.us>
Co-committed-by: phoenix <mail@kundeng.us>
2026-04-04 21:54:30 -04:00

47 lines
754 B
Go

package config
import (
"encoding/json"
"flag"
"log"
"os"
axlry "git.kundeng.us/phoenix/textsender-models/tx0/config/auxiliary"
)
const (
App_Name = "sender"
)
func IsVersionFlagPresent() bool {
versionFlag := flag.Bool("version", false, "Print version information")
flag.Parse()
if *versionFlag {
return true
} else {
return false
}
}
func ParseConfig(filepath string) (config axlry.TwilioConfig, success bool) {
content, err := os.ReadFile(filepath)
log.Println("Reading config file...")
log.Println(filepath)
if err != nil {
log.Println("An error reading the file")
return
}
err = json.Unmarshal(content, &config)
if err != nil {
log.Println("An error occurred")
return config, false
}
return config, true
}