How to pass custom configuration from plugins.js to a Strapi plugin component

Hi,

Create a controller under server/src/

write this inside;

module.exports = {
configController: async (ctx) => {
const config = strapi.config.get(“plugin.location-field”);
ctx.send(config);
},
};

and update routes/index.js like this;

// custom route to expose the values in config/plugins.js to the front end
module.exports = {
“admin”: {
type: “admin”,
routes: [
{
method: “GET”,
path: “/config”,
handler: “plugin::location-field.location-field.configController”,
config: {
policies: [“admin::isAuthenticatedAdmin”],
},
},
],
},
};

then fetch it from components.

for more information read codes of the example