mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 10:52:46 +00:00
Add local_environments to configuration files
Add `local` parameter to global `config` object to avoid repeating tests JWT key `secret` only added to global object `config` when local installation detected
This commit is contained in:
@@ -43,8 +43,6 @@ const Account = createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render : function(){
|
render : function(){
|
||||||
const localEnvironments = ['local', 'docker'];
|
|
||||||
|
|
||||||
// Logged in
|
// Logged in
|
||||||
if(global.account){
|
if(global.account){
|
||||||
return <Nav.dropdown>
|
return <Nav.dropdown>
|
||||||
@@ -75,7 +73,7 @@ const Account = createClass({
|
|||||||
|
|
||||||
// Logged out
|
// Logged out
|
||||||
// LOCAL ONLY
|
// LOCAL ONLY
|
||||||
if(localEnvironments.includes(global.config.environment)) {
|
if(global.config.local) {
|
||||||
return <Nav.item color='teal' icon='fas fa-sign-in-alt' onClick={this.localLogin}>
|
return <Nav.item color='teal' icon='fas fa-sign-in-alt' onClick={this.localLogin}>
|
||||||
login
|
login
|
||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
"naturalcrit_url" : "local.naturalcrit.com:8010",
|
"naturalcrit_url" : "local.naturalcrit.com:8010",
|
||||||
"secret" : "secret",
|
"secret" : "secret",
|
||||||
"web_port" : 8000,
|
"web_port" : 8000,
|
||||||
"enable_v3" : true
|
"enable_v3" : true,
|
||||||
|
"local_environments" : ["docker", "local"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,9 +262,16 @@ app.get('/print/:id', asyncHandler(async (req, res, next)=>{
|
|||||||
//Render the page
|
//Render the page
|
||||||
const templateFn = require('./../client/template.js');
|
const templateFn = require('./../client/template.js');
|
||||||
app.use((req, res)=>{
|
app.use((req, res)=>{
|
||||||
|
// Create configuration object
|
||||||
const configuration = {
|
const configuration = {
|
||||||
environment : config.get('node_env'),
|
local : false,
|
||||||
secret : config.get('secret')
|
environment : config.get('node_env')
|
||||||
|
};
|
||||||
|
// Add local only items to configuration object
|
||||||
|
const localEnvironments = config.get('local_environments');
|
||||||
|
if(localEnvironments.includes(configuration.environment)){
|
||||||
|
configuration.local = true;
|
||||||
|
configuration.secret = config.get('secret');
|
||||||
};
|
};
|
||||||
const props = {
|
const props = {
|
||||||
version : require('./../package.json').version,
|
version : require('./../package.json').version,
|
||||||
|
|||||||
Reference in New Issue
Block a user