Initialize stadia maps client on startup

This commit is contained in:
Eli Ribble 2026-03-05 02:14:24 +00:00
parent 61d9a21636
commit eb03cb5857
No known key found for this signature in database
2 changed files with 6 additions and 0 deletions

View file

@ -18,6 +18,7 @@ import (
"github.com/Gleipnir-Technology/nidus-sync/html"
"github.com/Gleipnir-Technology/nidus-sync/llm"
"github.com/Gleipnir-Technology/nidus-sync/platform/email"
"github.com/Gleipnir-Technology/nidus-sync/platform/geocode"
"github.com/Gleipnir-Technology/nidus-sync/platform/text"
"github.com/Gleipnir-Technology/nidus-sync/rmo"
nidussync "github.com/Gleipnir-Technology/nidus-sync/sync"
@ -111,6 +112,7 @@ func main() {
os.Exit(7)
}
geocode.InitializeStadia(config.StadiaMapsAPIKey)
router_logger := log.With().Logger()
sentryMiddleware := sentryhttp.New(sentryhttp.Options{
Repanic: true,

View file

@ -41,6 +41,10 @@ func (a Address) String() string {
var client *stadia.StadiaMaps
func InitializeStadia(key string) {
client = stadia.NewStadiaMaps(key)
}
// Either get an address that matches, or create a new address. Either way, return an address
// This will make a call to a structured geocode service, so it's slow.
func EnsureAddress(ctx context.Context, txn bob.Tx, org *models.Organization, a Address) (*models.Address, error) {