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
Relocate persistent data files into a user profile. #663
Relocate persistent data files into a user profile. #663
Conversation
0cf4821
to
68cf5a1
Compare
tools/make-self-signed-cert.sh
Outdated
openssl genrsa -out ssl/privatekey.pem 2048 | ||
openssl req -new -sha256 -key ssl/privatekey.pem -out ssl/csr.pem -subj '/CN=www.toizom.com/O=MozillaIoT Gateway/C=US' | ||
openssl x509 -req -in ssl/csr.pem -signkey ssl/privatekey.pem -out ssl/certificate.pem | ||
export SSL_DIR="${HOME}/mozilla-iot/data/ssl" |
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.
Does this need to be exported?
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.
And there really needs to be a way to override this. My mozilla-iot directory isn't in my HOME directory, it's in my Dropbox folder.
src/test/run-tests.sh
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
SCRIPTDIR="$(dirname ""$0"")" | |||
|
|||
if [ ! -f "ssl/certificate.pem" ]; then | |||
if [ ! -f "$HOME/mozilla-iot/data/ssl/certificate.pem" ]; then |
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.
We should probably have an environment variable like MOZIOT_HOME default to ${HOME}/mozilla-iot but allow it to be override. All of the bash scripts should probably use something like:
: ${MOZIOT_HOME:="${HOME}/mozilla-iot"}
or the slightly more verbose, but perhaps more easily understood
MOZIOT_HOME="${MOZIOT_HOME:=${HOME}/mozilla-iot}"
and then use ${MOZIOT_HOME} everywhere
src/app.js
Outdated
|
||
if (fs.existsSync('db.sqlite3')) { | ||
fs.renameSync('db.sqlite3', dbPath); | ||
} |
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 think that this deserves a comment to explain why its here (i.e. migration)
Can we have a quick discussion about this in our meeting today after planning the 0.4 release and before landing? It seems like a modestly large architectural change that warrants a group discussion. |
Codecov Report
@@ Coverage Diff @@
## master #663 +/- ##
========================================
Coverage ? 80.2%
========================================
Files ? 82
Lines ? 3354
Branches ? 426
========================================
Hits ? 2690
Misses ? 618
Partials ? 46
Continue to review full report at Codecov.
|
@benfrancis Sure thing. |
73f8aa3
to
88c58a3
Compare
6f2997e
to
d2f3241
Compare
These need to be moved out of the gateway tree for data persistence when using Docker. This will also allow users to easily switch profiles, if desired.
d2f3241
to
31f26f4
Compare
@benfrancis are we ready to move forward with this, or are there still outstanding issues? |
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.
Yes, this is OK with me. Probably a good idea!
}, | ||
bcryptRounds: 2 | ||
bcryptRounds: 2, |
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's with all the extra commas?
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.
It's not JSON, so the trailing commas make maintenance easier.
@@ -181,6 +183,7 @@ $ jest src/test/{test-name}.js | |||
* **`router.js`** - Routes app URLs to controllers | |||
* **`ssltunnel.js`** - Utilities to determine state of tunnel and manage the PageKite process | |||
* **`tunnel_setup.js`** - Express middleware to determine if the tunnel is set up | |||
* **`user-profile.js`** - Manages persistent user data |
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'm not sure it's really a user profile if it's shared by all users, but to be honest I can't think of a better name.
These need to be moved out of the gateway tree for data persistence
when using Docker. This will also allow users to easily switch
profiles, if desired.
Z-Wave logs and such will be handled at the add-on level.