v0.1.42 v0.1.42
Vernon Keenan 2021-01-28 11:17:39 -08:00
parent 5968d9f892
commit a220b714aa
4 changed files with 14 additions and 14 deletions

View File

@ -18,7 +18,7 @@ var auth0Expires time.Time
// GetAuth0AuthToken is a func // GetAuth0AuthToken is a func
func GetAuth0AuthToken() string { func GetAuth0AuthToken() string {
sugar.Infof("board.getAuth0AuthToken: 📥") sugar.Infof("app.getAuth0AuthToken: 📥")
if auth0Expires.After(time.Now()) { if auth0Expires.After(time.Now()) {
return auth0AuthToken return auth0AuthToken
} }
@ -31,12 +31,12 @@ func GetAuth0AuthToken() string {
} }
response, err := auth0Client.Auth.PostCredentials(apiParams) response, err := auth0Client.Auth.PostCredentials(apiParams)
if err != nil { if err != nil {
sugar.Errorf("board.getAuth0AuthToken: 💣 ⛔ : %w", err) sugar.Errorf("app.getAuth0AuthToken: 💣 ⛔ : %w", err)
} }
auth0Expires = time.Now().Add(time.Duration(response.Payload.ExpiresIn) * time.Second) auth0Expires = time.Now().Add(time.Duration(response.Payload.ExpiresIn) * time.Second)
auth0AuthToken = response.Payload.AccessToken auth0AuthToken = response.Payload.AccessToken
sugar.Debugf("board.getAuth0AuthToken: 📏 new token: %s", auth0AuthToken) sugar.Debugf("app.getAuth0AuthToken: 📏 new token: %s", auth0AuthToken)
sugar.Infof("board.getAuth0AuthToken: 👍 📤 new token retrieved") sugar.Infof("app.getAuth0AuthToken: 👍 📤 new token retrieved")
return auth0AuthToken return auth0AuthToken
} }

View File

@ -36,13 +36,13 @@ func GetCountyNameByGeocode(key string, principal *User) string {
// GetCountyByGeocode is first class retrieval function // GetCountyByGeocode is first class retrieval function
func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, error) { func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, error) {
sugar.Debug("plex.getCountyByGeocode: 📥") sugar.Debug("app.getCountyByGeocode: 📥")
if recordID == "" { if recordID == "" {
return geo_models.County{}, fmt.Errorf("plex.getCountyByID: 💣 ⛔ key is blank") return geo_models.County{}, fmt.Errorf("app.getCountyByID: 💣 ⛔ key is blank")
} }
obj, ok := countyCache.get(recordID) obj, ok := countyCache.get(recordID)
if ok { if ok {
sugar.Debug("plex.getCountyByGeocode: 👍 🎯 📤") sugar.Debug("app.getCountyByGeocode: 👍 🎯 📤")
return *obj, nil return *obj, nil
} }
geoParams := county.NewGetCountiesParamsWithTimeout(getTimeout) geoParams := county.NewGetCountiesParamsWithTimeout(getTimeout)
@ -56,6 +56,6 @@ func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, er
newObj = itm newObj = itm
} }
countyCache.put(recordID, newObj) countyCache.put(recordID, newObj)
sugar.Debug("plex.getCountyByGeocode: 👍 🆕 📤") sugar.Debug("app.getCountyByGeocode: 👍 🆕 📤")
return *newObj, nil return *newObj, nil
} }

View File

@ -41,13 +41,13 @@ func GetPlaceHasDistrictTaxesByGeocode(key string, principal *User) bool {
// GetPlaceByGeocode is first class retrieval function // GetPlaceByGeocode is first class retrieval function
func GetPlaceByGeocode(recordID string, principal *User) (geo_models.Place, error) { func GetPlaceByGeocode(recordID string, principal *User) (geo_models.Place, error) {
sugar.Debug("plex.getPlaceByGeocode: 📥") sugar.Debug("app.getPlaceByGeocode: 📥")
if recordID == "" { if recordID == "" {
return geo_models.Place{}, fmt.Errorf("plex.getPlaceByID: 💣 ⛔ key is blank") return geo_models.Place{}, fmt.Errorf("app.getPlaceByID: 💣 ⛔ key is blank")
} }
obj, ok := placeCache.get(recordID) obj, ok := placeCache.get(recordID)
if ok { if ok {
sugar.Debug("plex.getPlaceByGeocode: 👍 🎯 📤") sugar.Debug("app.getPlaceByGeocode: 👍 🎯 📤")
return *obj, nil return *obj, nil
} }
geoParams := place.NewGetPlacesParamsWithTimeout(getTimeout) geoParams := place.NewGetPlacesParamsWithTimeout(getTimeout)
@ -61,6 +61,6 @@ func GetPlaceByGeocode(recordID string, principal *User) (geo_models.Place, erro
newObj = itm newObj = itm
} }
placeCache.put(recordID, newObj) placeCache.put(recordID, newObj)
sugar.Debug("plex.getPlaceByGeocode: 👍 🆕 📤") sugar.Debug("app.getPlaceByGeocode: 👍 🆕 📤")
return *newObj, nil return *newObj, nil
} }

View File

@ -68,7 +68,7 @@ func InitConfig(systemName string, initalLogLevel zapcore.Level) {
} }
func initAPIUsers() map[string]User { func initAPIUsers() map[string]User {
sugar.Info("board.initAPIUsers: 📥") sugar.Info("app.initAPIUsers: 📥")
users := map[string]User{ users := map[string]User{
"auth": { "auth": {
APIKey: GetServiceAccount("auth").APIKey, APIKey: GetServiceAccount("auth").APIKey,
@ -86,6 +86,6 @@ func initAPIUsers() map[string]User {
GetServiceAccount("test-service-account").APIKey), GetServiceAccount("test-service-account").APIKey),
}, },
} }
sugar.Debugf("board.initAPIUsers: 👍 📤") sugar.Debugf("app.initAPIUsers: 👍 📤")
return users return users
} }