How to set password on sqlite database with node-sqlite3

The title says it all
15 Replies
Jochem
Jochem•2y ago
what are you trying to accomplish by setting a password?
dowellcamel
dowellcamelOP•2y ago
Shouldn't you do it?
Jochem
Jochem•2y ago
username / password is important if you access things through a network connection, but sqlite is a local file on disk you need to make sure your server is secure, that access to your files is restricted to only those who should have access, but generally you don't set passwords on sqlite there's some encryption options, but by that point it might be better to just switch to mysql or postgres
dowellcamel
dowellcamelOP•2y ago
So the server is what I should be making sure is secured, correct?
Jochem
Jochem•2y ago
yeah don't put your sqlite file anywhere web accessible is step 1 in that
dowellcamel
dowellcamelOP•2y ago
How do I do it?
Jochem
Jochem•2y ago
just don't keep it in your assets folder, probably not sure what your project looks like
dowellcamel
dowellcamelOP•2y ago
This might sound stupid, but should I gitignore the db?
Jochem
Jochem•2y ago
probably yes, as long as you have a way to set it up in git like, your initialization script should be in git, the .sqlite file probably shouldn't be
dowellcamel
dowellcamelOP•2y ago
Initialization script, being the script I used to make tables?
Jochem
Jochem•2y ago
yes your database structure is as much a part of your application as the Javascript, so if you lose that structure and the ability to recreate it, your application won't work your git repo should contain everything you need to get your application to work, but no instance data (as in data that would vary depending on where you installed your app) you could theoretically make a bare version of your db and commit that, and then copy that when you install your app, but it's better practice to use initialization scripts
dowellcamel
dowellcamelOP•2y ago
Assuming I pushed my db with data to a public repo. Am I in trouble?
Jochem
Jochem•2y ago
depends on your data 🤷
dowellcamel
dowellcamelOP•2y ago
Yeah, haha. I knew the answer Thanks Jochem. Im glad I asked here. Godbless you 🙂
Jochem
Jochem•2y ago
no worries, glad to help!
Want results from more Discord servers?
Add your server