You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I think it would be a nice addition to be able to configure the plugin (Google API key) with an environment variable.
In the meantime, if it help others, I've worked around this with the following boostrap function:
import{Strapi}from"@strapi/strapi";import{env}from"@strapi/utils";constconfigKey="GOOGLE_MAPS_API_KEY";// Workaround to the "strapi-google-maps" plugin not being configurable with environment variablesexportasyncfunctionbootstrapGoogleMapsConfig(strapi: Strapi): Promise<void>{constgoogleMapsApiKey=env(configKey);if(!googleMapsApiKey){thrownewError(`Missing ${configKey} in CMS env`);}const{ changes }=awaitstrapi.db.connection.raw(`UPDATE google_maps_configs SET google_maps_key = '${googleMapsApiKey}', updated_at = CURRENT_TIMESTAMP`,);if(changes===0){awaitstrapi.db.connection.raw(`INSERT INTO google_maps_configs(google_maps_key, created_at, updated_at) VALUES ('${googleMapsApiKey}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)`,);}}
Thanks for this plugin!
The text was updated successfully, but these errors were encountered:
Hello,
I think it would be a nice addition to be able to configure the plugin (Google API key) with an environment variable.
In the meantime, if it help others, I've worked around this with the following boostrap function:
Thanks for this plugin!
The text was updated successfully, but these errors were encountered: