-
Notifications
You must be signed in to change notification settings - Fork 63
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
GPII-3138: Update snapsets in data base #626
Changes from 32 commits
74dde50
ee30bb2
1c0f38a
b5dd8c0
f7068c0
e2f4e63
554ae82
f145f66
8f54a33
67f7bd6
c48d7ae
f029df2
5f2f1b5
750cdf3
0e41600
22d6605
574236f
d6547d3
8520379
ef1e721
0181c42
9bb64af
a4541ba
e026465
f4c41a6
6723b6e
2e0bb55
fae02da
831a762
582b3d7
c401c97
54defe7
58fdde7
0862af6
79abd7d
2b8cbeb
59f03a8
6ee716e
9a090a1
a9eec11
a4cf452
63c1a11
7ce1b84
afc6888
75456ba
230c8f0
23b27e4
33f1741
2c48ca5
d9ac25e
ebde69d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt | |
*/ | ||
|
||
// This script reads files from an input directory that contains preferences JSON5 files and convert them to JSON files of GPII keys and | ||
// preferences safes suitable for direct loading into CouchDB or PouchDB, which comply with the new GPII data model: | ||
// preferences safes suitable for direct loading into CouchDB or PouchDB, which comply with the new GPII data model: | ||
// https://wiki.gpii.net/w/Keys,_KeyTokens,_and_Preferences in the target directory | ||
// Usage: node scripts/convertPrefs.js {input_path} {target_path} | ||
// | ||
|
@@ -25,14 +25,14 @@ var fs = require("fs"), | |
|
||
var inputDir = process.argv[2]; | ||
var targetDir = process.argv[3]; | ||
var prefsSafeType = process.argv[4]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either check
to set "user" as the default if this argument is optional. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've modified the code to use the "or" form. Still ... shouldn't we check that it's either "snapset" or "user" and quit if it's neither -- what if someone entered "group" for the type, for example? Or, will there be other types of prefsSafes in the future? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Harmless to check. I cannot tell at the moment if there will be other types of prefsSafes in the future. |
||
|
||
var prefsSafes = []; | ||
var gpiiKeys = []; | ||
var count = 0; | ||
|
||
var filenames = fs.readdirSync(inputDir); | ||
|
||
console.log("Converting preferences data in the source directory " + inputDir + " to the target directory " + targetDir + " ..."); | ||
console.log("Converting preferences data in the source directory " + inputDir + " to the target directory " + targetDir + " as " + prefsSafeType + " Prefs Safes ..."); | ||
|
||
// Read and loop thru json5 files in the input directory | ||
rimraf(targetDir, function () { | ||
|
@@ -61,7 +61,7 @@ rimraf(targetDir, function () { | |
"_id": prefsSafeId, | ||
"type": "prefsSafe", | ||
"schemaVersion": "0.1", | ||
"prefsSafeType": "user", | ||
"prefsSafeType": prefsSafeType, | ||
"name": gpiiKey, | ||
"password": null, | ||
"email": null, | ||
|
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.
Update the usage too.
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.
Sure.