summaryrefslogtreecommitdiff
path: root/config.Load.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-21 06:41:28 -0500
committerJeff Carr <[email protected]>2025-10-21 06:41:28 -0500
commit5036409ef63bc4bf9b63d7dd0cf06cdcb2285ab9 (patch)
tree725760124ab53cc1475fe0b4ca5fa0a62078a209 /config.Load.go
parent93a56f29dbf3bcceb3a58d59bc996845b762cb31 (diff)
use lib/ENV
Diffstat (limited to 'config.Load.go')
-rw-r--r--config.Load.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/config.Load.go b/config.Load.go
index 6a5f3e9..9f8f6ce 100644
--- a/config.Load.go
+++ b/config.Load.go
@@ -1,13 +1,10 @@
package config
import (
- "errors"
"os"
- "os/user"
"path/filepath"
- "strings"
- "go.wit.com/log"
+ "go.wit.com/lib/ENV"
)
// loads your applications config file from
@@ -29,6 +26,7 @@ func (pb *Config) Load() error {
return err
}
+/*
func loadENV() error {
if configPB != nil {
log.Info("configPB already loaded")
@@ -80,9 +78,10 @@ func getConfigFilenameENV() (string, error) {
filename := filepath.Join(configdir, appname+".ENV")
return filename, nil
}
+*/
func getConfigFilenameTEXT() (string, error) {
- appname, err := GetAppname() // already configured by your application
+ appname, err := ENV.GetAppname() // already configured by your application
if err != nil {
return "", err
}
@@ -96,6 +95,7 @@ func getConfigFilenameTEXT() (string, error) {
return filename, nil
}
+/*
func GetAppname() (string, error) {
if APPNAME != "" {
return APPNAME, nil
@@ -113,15 +113,16 @@ func GetUsername() string {
}
return "notsure" // OS Idiocracy
}
+*/
func getCacheDir() (string, error) {
- if Get("cacheDir") != "" {
- return Get("cacheDir"), nil
- }
+ // if Get("cacheDir") != "" {
+ // return Get("cacheDir"), nil
+ // }
cacheDir, _ := os.UserCacheDir()
- appname, err := GetAppname() // application should have already configured this
+ appname, err := ENV.GetAppname() // application should have already configured this
if err != nil {
return cacheDir, err
}
@@ -130,13 +131,13 @@ func getCacheDir() (string, error) {
}
func getConfigDir() (string, error) {
- if Get("configDir") != "" {
- return Get("configDir"), nil
- }
+ // if Get("configDir") != "" {
+ // return Get("configDir"), nil
+ // }
configDir, _ := os.UserConfigDir()
- appname, err := GetAppname() // application should have already configured this
+ appname, err := ENV.GetAppname() // application should have already configured this
if err != nil {
return configDir, err
}