-
Notifications
You must be signed in to change notification settings - Fork 48
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
Init command and enhanced init-db #369
base: develop
Are you sure you want to change the base?
Conversation
- it's using all commands available in server
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.
Looks great, let me try it.
Pull Request Test Coverage Report for Build 13237930325Details
💛 - Coveralls |
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.
Looking good!
fg="red", | ||
), | ||
_echo_error( | ||
"No base URL set. Please set MERGIN_BASE_URL environment variable", |
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.
shall we also check contact_email variable? I'd maybe use it for admin/test email
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 can, but it's not required variable - see docs https://merginmaps.com/docs/server/administer/environment/
|
||
tables = db.engine.table_names() | ||
if not tables or recreate: | ||
_init_db() |
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 recreate flag might be dangerous, shall we ask for user confirmation?
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.
added
- use default value CONTACT_EMAIL for init
init
command$ flask init --help Usage: flask init [OPTIONS] Initialize database if does not exist or -r is provided. Perform check of server configuration. Send statistics, respecting your setup. Options: -e, --email TEXT [required] -r, --recreate Recreate database and admin user. --help Show this message and exit.
Initialization of fresh server
The -e/--email option is required. This parameter is used for creating the admin user and sending a check email.
Several steps are performed by this command when a fresh server instance is initialized:
*If COLLECT_STATISTICS is enabled, the command attempts to send statistics to MM servers.
Initialization of an already initialized server
The
-r
/--recreate
option recreating database and admin user with new password from scratch.init
command with already initialized DB, without-r
and disabledCOLLECT_STATISTICS
. It's just sending check email and perform health check.init-db
commandIt's just creating new database and and new MerginInfo row with service id. It could be still used for development.