ginger
ginger copied to clipboard
[Admin, Base] Add theme colors to different environments
To quickly distinguish if a user is on acceptance or production (or developers on dev and test)
For discerning the live/testing/staging, maybe we could add a colored bar at the top or one of the sides? Another option is to add a 'theme' class to the admin, so that we always echo that configured class name in the body tag (within the admin). Then you can add some css to change colors and/or some texts.
To make the environment (i.e. theme) selection more generic, we could base it on a server configuration variable (in zotonic.config
).
Yes, that is a good idea. At least something that can completely overruled by the server configuration.
We can then fetch it using m.site.environment
.
In this way it is still possible to have a not-yet-live site on a production server, and switch it to production
in a very visible way.
In the code I see the following possible stages:
-
dev
-
test
-
acceptance
-
production
Checking DTAP (https://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_production) I see:
- Development
- Test
- Acceptance
- Production
- Education (for learning the environment by new users)
- Backup (a backup site for disaster recovery)
Shall we use these names for possible values?
Proposal:
- Add
zotonic.config
settingenvironment
(possible values, see above) - Add optional site configuration
environment
(overrules 1, so is possible to have a backup or education site on production server) - Add
m.site.environment
which echos the current environment, defaults toproduction
- Set a class
environment-{{ m.site.environment }}
on the html tag in admin and other Zotonic base templates (idem for Ginger base templates) - Set a HTTP response header:
X-DTAP-Environment: ...
reflecting the current environment.
I added an issue for Zotonic here: https://github.com/zotonic/zotonic/issues/2120
See the merge request here: https://github.com/zotonic/zotonic/pull/2137
The merge request in Zotonic is awaiting acceptance.