New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
global: environment labeling #227
global: environment labeling #227
Conversation
9ab5149
to
f804775
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nice thank you!
|
||
const EnvironmentLabelComponent = ({ pointing, ...uiProps }) => { | ||
const environment = process.env.REACT_APP_ENV_NAME; | ||
if (!environment || environment === 'development') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would propose to put by default our envs, so we don't have to override :)
or maybe you can add to the invenioConfig.APP
a new obj/list with all the possible envs, e.g.:
invenioConfig.APP.environments: [{
name: 'dev',
text: 'Dev environment',
color: 'blue'
icon: ...
}]
and then here:
env = invenioConfig.APP.environments.filter(env => env.name === process.env.REACT_APP_ENV_NAME);
return (
<EnvironmentLabelLayout
icon="code"
text="Development environment"
color="blue"
pointing={pointing}
{...uiProps}
/>
);
...
in CDS-ILS, we will have only to add the config.
WDYT?
I will add now the var REACT_APP_ENV_NAME
to the deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What REACT_APP_ENV_NAME
name did you use in the end? So that we align.
Edit: sandbox
f804775
to
d43898e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/lib/config/defaultConfig.js
Outdated
}, | ||
}, | ||
{ | ||
name: 'qa', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In CDS-ILS this will be called sandbox
, and prod not sure yet between prod
and production
. If you keep qa
here, please create a PR in CDS-ILS to override the config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with the red maybe we can take a bit less eyes hurting shade? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update qa
to sandbox
. For the naming I would personally go for production
and development
, to match sandbox
.
d43898e
to
ebf2049
Compare
I came up with the following: {
name: 'production',
display: {
roles: ['admin'],
text: 'Production environment',
color: 'red',
icon: 'warning',
},
} Production will be highlighted to logged-in admins only. The other environment configurations ( |
Displays a label on all pages indicating the current environment that is being run. If production nothing is displayed. The environment type can be set in
.env
by setting a value toREACT_APP_ENV_NAME
. The currently supported values aredevelopment
,preprod
andproduction
. An empty value is considered as a development environment. The component in charge of this can be overridden to support more environment types, along with their label.Development environment
Frontsite
Login
Backoffice
Pre-prod / QA
(ditto for the two other ends)