Reviewed-on: phoenix/twilio_sender#1
Co-authored-by: kdeng00 <kundeng94@gmail.com>
Co-committed-by: kdeng00 <kundeng94@gmail.com>
This commit is contained in:
kdeng00
2024-08-24 21:20:30 +00:00
committed by phoenix
parent fda603e0c0
commit 7b55ff5be2
14 changed files with 383 additions and 30 deletions
+31
View File
@@ -0,0 +1,31 @@
package config
import "encoding/json"
import "fmt"
import "os"
import (
"git.kundeng.us/phoenix/twilio_sender/models"
)
func ParseConfig(filepath string) (config models.TwiloDetails, success bool) {
content, err := os.ReadFile(filepath)
fmt.Println("Reading config file...")
fmt.Printf("%s\n", filepath)
if err != nil {
fmt.Println("An error reading the file")
return
}
err = json.Unmarshal(content, &config)
if err != nil {
fmt.Println("An error occurred")
return config, false
}
return config, true
}