v2-hub
v2-hub copied to clipboard
Environments - Option 2: Environment files and (not)editing in CP
Option 2: Environment files doesn't show Managed externally by your environment. in CP (as the doc says here) Option 1: Interpolation works well.
.env:
APP_ENV=dev
site/settings/debug.yaml:
debug: false
debug_bar: false
loggers:
file:
daily: true
site/settings/environments/dev.yaml:
settings:
debug:
debug: true
debug_bar: true
Settings works. Debug is enabled as long as APP_ENV equal dev in .env file. But in CP I expect Managed externally by your environment. But there are regular editable inputs.
If APP_ENV == dev and site/settings/environments/dev.yaml exists (as above): I can change the settings and submit the form. Statamic says Settings saved. but no change is saved in fact. After page refresh there are an original values (values from site/settings/environments/dev.yaml).
If APP_ENV != dev and current-env .yaml file doesn't exists: I can change the settings, submit the form and changes are saved successfully into default settings file site/settings/debug.yaml
Expected behavior
- nothing editable as in Option 1: Interpolation and Managed externally by your environment or
- everything editable. As I can edit default settings file I want to edit env.yaml file as well
Environment details:
- Statamic Version 2.11.15
- Fresh Install or Upgrade: Upgrade from 2.11.14
- OS: Linux
- Browser: chrome
- Web Server: Nginx
- PHP Version: 7.2
- Addons installed: spock
I can confirm this. Using Option 2 does not make the values in CP non-editable.
Using values from an environment file .env disables a settings field entirely. Instead the message "Managed externally by your environment." is displayed.
@miloslavkostir In your example, this would mean using:
site/settings/environments/dev.yaml
settings:
debug: "{env:APP_DEBUG}"
debug: true
debug_bar: true
.env
APP_DEBUG=true
From what the docs state, both options should disable the editing of the values in CP.
This seems like a bug @jackmcdade @jasonvarga?
Agreed its a bug. But in my opinion it's better to use the .env option anyway. The other way is removed in v3, it's confusing.