mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-26 08:51:22 -06:00
feature: ELECTRON-1204: allow set expiry to take period dynamically
This commit is contained in:
parent
2e80c599fc
commit
1b79deb24a
@ -48,20 +48,22 @@ gulp.task('copy', function () {
|
||||
*/
|
||||
gulp.task('setExpiry', function (done) {
|
||||
// Set expiry of 15 days for test builds we create from CI
|
||||
const expiryDays = 15;
|
||||
const expiryDays = process.argv[4] || 15;
|
||||
console.log(`Setting expiry to ${expiryDays} days`);
|
||||
const milliseconds = 24*60*60*1000;
|
||||
const expiryTime = new Date().getTime() + (expiryDays * milliseconds);
|
||||
console.log(`Setting expiry time to ${expiryTime}`);
|
||||
|
||||
const ttlHandlerFile = path.join(__dirname, 'src/app/ttl-handler.ts');
|
||||
fs.readFile(ttlHandlerFile, 'utf8', function (err,data) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
return done(err);
|
||||
}
|
||||
|
||||
// Do a simple search and replace in the `ttl-handler.ts` file
|
||||
const replacementString = `const ttlExpiryTime = ${expiryTime}`;
|
||||
var result = data.replace(/const ttlExpiryTime = -1/g, replacementString);
|
||||
const result = data.replace(/const ttlExpiryTime = -1/g, replacementString);
|
||||
|
||||
fs.writeFile(ttlHandlerFile, result, 'utf8', function (err) {
|
||||
if (err) {
|
||||
|
@ -19,7 +19,6 @@
|
||||
"packed-mac": "npm run unpacked-mac && packagesbuild -v installer/mac/symphony-mac-packager.pkgproj",
|
||||
"prebuild": "npm run compile && npm run rebuild && npm run browserify-preload",
|
||||
"rebuild": "electron-rebuild -f",
|
||||
"setexpiry": "gulp setExpiry",
|
||||
"start": "npm run compile && npm run browserify-preload && cross-env ELECTRON_DEV=true electron .",
|
||||
"test": "npm run lint && cross-env ELECTRON_QA=true jest --config jest.config.json --runInBand",
|
||||
"unpacked-mac": "npm run prebuild && npm run test && build --mac --dir",
|
||||
|
Loading…
Reference in New Issue
Block a user