parent
5968d9f892
commit
a220b714aa
|
@ -18,7 +18,7 @@ var auth0Expires time.Time
|
|||
|
||||
// GetAuth0AuthToken is a func
|
||||
func GetAuth0AuthToken() string {
|
||||
sugar.Infof("board.getAuth0AuthToken: 📥")
|
||||
sugar.Infof("app.getAuth0AuthToken: 📥")
|
||||
if auth0Expires.After(time.Now()) {
|
||||
return auth0AuthToken
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ func GetAuth0AuthToken() string {
|
|||
}
|
||||
response, err := auth0Client.Auth.PostCredentials(apiParams)
|
||||
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)
|
||||
auth0AuthToken = response.Payload.AccessToken
|
||||
sugar.Debugf("board.getAuth0AuthToken: 📏 new token: %s", auth0AuthToken)
|
||||
sugar.Infof("board.getAuth0AuthToken: 👍 📤 new token retrieved")
|
||||
sugar.Debugf("app.getAuth0AuthToken: 📏 new token: %s", auth0AuthToken)
|
||||
sugar.Infof("app.getAuth0AuthToken: 👍 📤 new token retrieved")
|
||||
return auth0AuthToken
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ func GetCountyNameByGeocode(key string, principal *User) string {
|
|||
|
||||
// GetCountyByGeocode is first class retrieval function
|
||||
func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, error) {
|
||||
sugar.Debug("plex.getCountyByGeocode: 📥")
|
||||
sugar.Debug("app.getCountyByGeocode: 📥")
|
||||
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)
|
||||
if ok {
|
||||
sugar.Debug("plex.getCountyByGeocode: 👍 🎯 📤")
|
||||
sugar.Debug("app.getCountyByGeocode: 👍 🎯 📤")
|
||||
return *obj, nil
|
||||
}
|
||||
geoParams := county.NewGetCountiesParamsWithTimeout(getTimeout)
|
||||
|
@ -56,6 +56,6 @@ func GetCountyByGeocode(recordID string, principal *User) (geo_models.County, er
|
|||
newObj = itm
|
||||
}
|
||||
countyCache.put(recordID, newObj)
|
||||
sugar.Debug("plex.getCountyByGeocode: 👍 🆕 📤")
|
||||
sugar.Debug("app.getCountyByGeocode: 👍 🆕 📤")
|
||||
return *newObj, nil
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ func GetPlaceHasDistrictTaxesByGeocode(key string, principal *User) bool {
|
|||
|
||||
// GetPlaceByGeocode is first class retrieval function
|
||||
func GetPlaceByGeocode(recordID string, principal *User) (geo_models.Place, error) {
|
||||
sugar.Debug("plex.getPlaceByGeocode: 📥")
|
||||
sugar.Debug("app.getPlaceByGeocode: 📥")
|
||||
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)
|
||||
if ok {
|
||||
sugar.Debug("plex.getPlaceByGeocode: 👍 🎯 📤")
|
||||
sugar.Debug("app.getPlaceByGeocode: 👍 🎯 📤")
|
||||
return *obj, nil
|
||||
}
|
||||
geoParams := place.NewGetPlacesParamsWithTimeout(getTimeout)
|
||||
|
@ -61,6 +61,6 @@ func GetPlaceByGeocode(recordID string, principal *User) (geo_models.Place, erro
|
|||
newObj = itm
|
||||
}
|
||||
placeCache.put(recordID, newObj)
|
||||
sugar.Debug("plex.getPlaceByGeocode: 👍 🆕 📤")
|
||||
sugar.Debug("app.getPlaceByGeocode: 👍 🆕 📤")
|
||||
return *newObj, nil
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ func InitConfig(systemName string, initalLogLevel zapcore.Level) {
|
|||
}
|
||||
|
||||
func initAPIUsers() map[string]User {
|
||||
sugar.Info("board.initAPIUsers: 📥")
|
||||
sugar.Info("app.initAPIUsers: 📥")
|
||||
users := map[string]User{
|
||||
"auth": {
|
||||
APIKey: GetServiceAccount("auth").APIKey,
|
||||
|
@ -86,6 +86,6 @@ func initAPIUsers() map[string]User {
|
|||
GetServiceAccount("test-service-account").APIKey),
|
||||
},
|
||||
}
|
||||
sugar.Debugf("board.initAPIUsers: 👍 📤")
|
||||
sugar.Debugf("app.initAPIUsers: 👍 📤")
|
||||
return users
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue