1

Hi I am using Craft CMS with the project config file to keep various environments in sync. This generally works fine but I have run into an issue with plugin settings.

I am using the Contact Forms Extension and want to use the reCaptcha on my production site but I want it disabled locally. If I enable it on my production site, it gets disabled every time I deploy as I have it disabled locally.

Is there anyway I can create a plugin settings config to override the project config file?

2

I'm not familiar with this plugin, but could probably do this in your template where the plugin is called:

// Get the environment
{% set env = getenv('ENVIRONMENT') %}

// If anything but dev, then load the plugin
{% if env != 'dev' %}
    {% include ['_recaptcha/frontend'] %} 
{% endif %}

You can also get the environment from the config:

{% set env = craft.app.config.env %}

| improve this answer | |
  • thanks for the reply. I know I can remove this from the front end of the website. My question was more related to the plugin settings. i.e there is an option to save responses to the database - if I wanted this on in production but off in local. The Contact Form plugin allows you to have a config file that can have different settings per env – Pedro Sep 4 '19 at 19:46
  • Gotcha. If the plugin has override-able settings then you should be able to do this in the same way as the contact form plugin. – user3788089 Sep 4 '19 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.