Custom field settings

Hi Arrigo,

it seems to me that the config is only present in the server for security reasons. You want to protect your api key from public access. So I would write an endpoint, and make some configurations public. In the component you can then get your configuration via the endpoint.

src/plugins/yourPluginName/server/controllers/my-controller.ts

export default ({ strapi }: { strapi: Strapi }) => ({
  async getColorFormConfig() {
    return strapi.plugin(pluginName).config("color", "#000");
  },

Then you need to register the controller here: src/plugins/yourPluginName/server/controllers/index.ts

import myController from './my-controller';

export default {
  myController,
};

You will also need a route.

export default [
  {
    method: "GET",
    path: "/",
    handler: "myController.getColorFormConfig",
    config: {
      policies: [],
      auth: false,
    },
  }
];

Now you can fetch the color setting from your component.
http://localhost:1337/yourPluginName

Greets