Answers.Body: <p>In short, no. If this is config or data which are environment specific, they are as likely not good candidates for project config. Perhaps consider moving them to a table and access them through a Record/Model?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-03T15:11:54.407Z
Answers.LastActivityDate: 2020-11-03T15:11:54.407Z
Answers.UserDisplayName: Wallace
Body: <p>I have a plugin/module that synchronises local records with a Google Sheet managed by the client.
  The URL for this doc is stored in a module config.</p>
  <p>I want the client to be able to update this via the control panel so have created a template for editing and a controller to update the config. This is all fine locally but in the client environment where <code>allowAdminChanges</code> is set to false this won't save and I get the following error:</p>
  <pre><code> Changes to the project config are not possible while in read-only mode.
  </code></pre>
  <p>I have tried both <code>Craft::$app-&gt;projectConfig-&gt;set('my-module', $settings);</code> and <code>Craft::$app-&gt;getSystemSettings()-&gt;saveSettings('mud-module', $settings)</code> with same ersponse.</p>
  <p>Is there a way to update config when <code>allowAdminChanges</code> is set to 0/false?</p>
  
Tags: <plugin-development><config>
Title: Updating plugin/module config via template/controller
ThreadText: # Updating plugin/module config via template/controller
  
  (Asked by: username_0 on 2020-11-03)
  
  I have a plugin/module that synchronises local records with a Google Sheet managed by the client.
  The URL for this doc is stored in a module config.
  
  I want the client to be able to update this via the control panel so have created a template for editing and a controller to update the config. This is all fine locally but in the client environment where `allowAdminChanges` is set to false this won't save and I get the following error:
  
  ```
   Changes to the project config are not possible while in read-only mode.
  
  ```
  
  I have tried both `Craft::$app->projectConfig->set('my-module', $settings);` and `Craft::$app->getSystemSettings()->saveSettings('mud-module', $settings)` with same ersponse.
  
  Is there a way to update config when `allowAdminChanges` is set to 0/false?
  
  **Tags:** plugin-development, config
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-11-03. Score: 2 | Accepted answer
  
  In short, no. If this is config or data which are environment specific, they are as likely not good candidates for project config. Perhaps consider moving them to a table and access them through a Record/Model?
  
  
  ---
  
  