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
fix: 'archivy init' does not purge old configuration before interactive init #164
base: master
Are you sure you want to change the base?
Conversation
…ve init archivy does not reset the configuration before creating the new user. This is because archivy calls click.create_admin before resetting the configuration. It is also recommended to purge the configuration, (and not replace existing conf), to remove old entries along with this patch, a new value, VERSION would be added to the configuration which would be useful in future to migrate old configuration to new configuration tree.
Codecov Report
@@ Coverage Diff @@
## master #164 +/- ##
==========================================
+ Coverage 81.22% 81.25% +0.03%
==========================================
Files 27 27
Lines 1704 1707 +3
==========================================
+ Hits 1384 1387 +3
Misses 320 320
Continue to review full report at Codecov.
|
…t in archivy init previously, archivy, when running 'archivy init' never asked the user if they would like to remove the old users, i.e db.json. It would be useful to ask the user if they would like to remove them
remove_old_users = click.confirm("Found an existing user database. Do you want " | ||
"to remove them?") | ||
if remove_old_users: | ||
users_db.unlink() |
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 would also remove other db objects. Maybe we can just inform them there are other created users and provide a delete-user
command?
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 other information can the db contain?
|
||
class Config(object): | ||
"""Configuration object for the application""" | ||
|
||
VERSION = VERSION |
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.
Maybe we can directly define it as VERSION = 1
here?
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, agreed.
Sorry, posted that at the wrong place 😅 |
archivy does not reset the configuration before creating the new user.
This is because archivy calls click.create_admin before resetting the configuration.
It is also recommended to purge the configuration, (and not replace existing conf), to
remove old entries
along with this patch, a new value, VERSION would be added to the configuration
which would be useful in future to migrate old configuration to new configuration tree.