-
Notifications
You must be signed in to change notification settings - Fork 370
Safe init: do not overwrite cert, key and config if present, close #400 #413
base: master
Are you sure you want to change the base?
Conversation
scripts/first_time.rb
Outdated
puts "Copying configuration settings over." | ||
File.open("./config.json", "w") do |f| | ||
f.write File.open("./config.json.defaults", "rb").read | ||
if !File.exist?('cert.pem') |
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.
This should be checking if config.json exists, correct?
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.
Ehh yes, sorry about that.
Thanks for pointing out the copy-paste error. I would suggest I fix this and force-push the branch so that it is only 1 commit (no pollution of commits after merge) and we do not have to create a new pr (would be kind of weird). I was told that force-pushing to pr branches is generally accepted, what is your opinion on this? |
I have no preference. I am good with you updating this PR or creating a new one. |
I've realized we also need a check to see if the config.json is unchanged from the git repo, if so overwrite it. Otherwise, new installs won't get the newest features from config.json.defaults. |
…rpicoProject#400 If either key or cert is missing, both are regenerated
f8f74ad
to
0214c1a
Compare
Updated the PR with the fixed version. Concerning updates: If we assume Talking about this, I just realized I did not know that the config is under versioning when I created this PR. It effectively defeats the whole purpose of this PR since the original idea was having a docker environment where you could have your config included via volume mount, which (I just realized) will still be overwritten by the git checkout even if this PR prevent the I mean the PR is still valid as the current implementation is inconsistent, and it solves the problem for the key and cert as well. However, the config problem is still there... But I guess we should discuss this in another issue/thread. |
Essentially, I just check whether the files exist. Concerning the SSL key and cert, I regenerate them if at least one is missing.