Skip to content

Commit

Permalink
Allow for hiding fields via secondary configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmarreirosdeoliveira committed Mar 6, 2018
1 parent 4e424cb commit b184854
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 76 deletions.
3 changes: 2 additions & 1 deletion app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ let pconf: any = undefined;

return() => {
const PROJECT_CONFIGURATION_PATH = remote.getGlobal('configurationPath');
appConfigurator.go(PROJECT_CONFIGURATION_PATH);
const HIDDEN_CONFIGURATION_PATH = remote.getGlobal('hiddenConfigurationPath');
appConfigurator.go(PROJECT_CONFIGURATION_PATH, HIDDEN_CONFIGURATION_PATH);

return (configLoader.getProjectConfiguration() as any).then((pc: any) => {
pconf = pc as any;
Expand Down
1 change: 1 addition & 0 deletions config/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# Explicitely mention files which should be part of the repo.

!Configuration.json.template
!Hidden.json.template
!README.md

Empty file added config/Hidden.json.template
Empty file.
10 changes: 10 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,14 @@ gulp.task('create-configs', function (callback) {
console.log('Will not create ' + path + ' from template because file already exists.');
}
});

var hpath = './config/Hidden.json';

fs.access(hpath, fs.F_OK, function(err) {
if (err) {
fs.createReadStream(hpath + '.template').pipe(fs.createWriteStream(hpath));
} else {
console.log('Will not create ' + hpath + ' from template because file already exists.');
}
});
});
4 changes: 3 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if (process.argv && process.argv.length > 2) {
}
if (env) { // is environment 'dev' (npm start) or 'test' (npm run e2e)
global.configurationPath = 'config/Configuration.json';
global.hiddenConfigurationPath = 'config/Hidden.json';
}


Expand All @@ -34,7 +35,8 @@ if (!env || // is environment 'production' (packaged app)
global.configPath = global.appDataPath + '/config.json';

if (!env) { // is environment 'production' (packaged app)
global.configurationPath = '../config/Configuration.json'
global.configurationPath = '../config/Configuration.json';
global.hiddenConfigurationPath = '../config/Hidden.json';
}

} else { // is environment 'test' (npm run e2e)
Expand Down
146 changes: 73 additions & 73 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"systemjs": "0.19.31",
"zone.js": "0.8.11",
"express-pouchdb-dainst": "1000.0.3",
"idai-components-2": "1.6.2",
"idai-components-2": "1.7.1",
"tsfun": "1.7.0"
},
"devDependencies": {
Expand Down

0 comments on commit b184854

Please sign in to comment.