Wylbur's picture

This was an old trick for Drupal 7.  By adding a settings.local.php file, we could set the 'file_private_path' and this would automatically override the config settings.  I tried that tonight, but after importing the active site config, the private path is set to the value in the config files.  

```$settings['file_private_path'] = 'private';```

Any way to override that for local? 

As an addendum to this answer, part of my work tonight was writing a sync script using BRUSH.  I have opened an issue there asking about enabling variable-set commands in brush, but that is probably also related to the question above.  

Thanks!

Comments

Hey Wylbur,

See the 'Configuration overrides' section of settings.php:

These settings allow you to specify values for anything stored in config within the files stored in the $config_directories variable above. This can be useful to store per-environment values or sensitive data that is undesirable to store in the config storage.

There are particular configuration values that are risky to override. For example overriding field storage will create errors because associated database changes are necessary. Modifying values within complicated objects such as views, content types, vocabularies, etc. may not work as expected. Use any available API functions for complex systems instead.

$config['system.core']['site_name'] = 'My Backdrop site';
$config['system.core']['file_temporary_path'] = '/tmp';
klonos's picture

As an addendum to this answer, part of my work tonight was writing a sync script using BRUSH.  I have opened an issue there asking about enabling variable-set commands in brush...

Cross-posting my reply from https://github.com/backdrop-contrib/brush/issues/24 ...

Hey @Wylbur 👋 

variable_get() and variable_set() have been deprecated in Backdrop, in favor of CMI. See the following resources for more info:

- https://api.backdropcms.org/change-records/converted-all-variables-cmi
- https://api.backdropcms.org/documentation/working-with-configuration
- https://api.backdropcms.org/api/backdrop/1/search/variable_get
- https://api.backdropcms.org/api/backdrop/1/search/variable_set

You will need to use the config_get() and config_set() functions respectively instead.

For brush specifically, the relevant config-* commands seem to be:

  • brush config-list (brush clist for short)
  • brush config-get (brush cget for short)
  • brush config-set (brush cset for short)
  • brush config-clear (brush cdel for short)

See the config_brush_command() function for details: https://github.com/backdrop-contrib/brush/blob/1.x-1.x/commands/core/con...

PS: there seem to be aliases set for the "old" variable-* commands, but you should stop using those:

  • brush clist may also be brush vlist
  • brush cget may also be brush vget
  • brush cset may also be brush vset
  • brush cdel may also be brush vdel

For setting the stage_file_proxy_origin setting specifically, please try the following command (untested):

brush cset --yes stage_file_proxy.settings origin "http://www.example.com"

To find which settings file and which specific "variable" ("setting" now) to use for the command above, I've looked in the /config folder of the stage_file_proxy module, for its default .json config file. See: https://github.com/backdrop-contrib/stage_file_proxy/blob/1.x-1.x/config...

Hope this helps 😉