Commit dac0326b authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

Merge branch 'default-password-from-env' into 'master'

Took default user password and email from env on initial migrations

See merge request noc/noc!2374
parents 6fa0157e 11825331
......@@ -6,8 +6,12 @@
# See LICENSE for details
# ----------------------------------------------------------------------
# Third-party modules
from django.contrib.auth.hashers import make_password
# NOC modules
from noc.core.migration.base import BaseMigration
from noc.config import config
class Migration(BaseMigration):
......@@ -20,11 +24,11 @@ class Migration(BaseMigration):
"(username, first_name, last_name, email, password, is_active, is_superuser, date_joined) "
"VALUES(%s, %s, %s, %s, %s, %s, %s, 'now')",
[
"admin",
config.initial.admin_user_name,
"NOC",
"Admin",
"test@example.com",
"sha1$235c1$e8e4d9aaa945e1fae62a965ee87fbf7b4a185e3f",
config.initial.admin_email,
make_password(config.initial.admin_password),
True,
True,
],
......
......@@ -287,6 +287,11 @@ class Config(BaseConfig):
https_port = IntParameter(default=443)
validate_certs = BooleanParameter(default=False, help="Have to be set as True")
class initial(ConfigSection):
admin_user_name = StringParameter(default="admin")
admin_password = StringParameter(default="admin")
admin_email = StringParameter(default="test@example.com")
installation_name = StringParameter(default="Unconfigured installation")
instance = IntParameter(default=0)
......
.. _config-initial:
initial
-------
Initial post-installation settings
.. _config-initial-admin_user_name:
admin_user_name
~~~~~~~~~~~~~~~
Initial NOC admin's username
================== ===========================
**YAML Path** initial.admin_user_name
**Key-Value Path** initial/admin_user_name
**Environment** NOC_INITIAL_ADMIN_USER_NAME
**Default Value** admin
================== ===========================
.. _config-initial-admin_password:
admin_password
~~~~~~~~~~~~~~
Initial NOC admin's password
================== ===========================
**YAML Path** initial.admin_password
**Key-Value Path** initial/admin_password
**Environment** NOC_INITIAL_ADMIN_PASSWORD
**Default Value** admin
================== ===========================
.. _config-initial-admin_email:
admin_email
~~~~~~~~~~~
Initial NOC admin's email
================== =======================
**YAML Path** initial.admin_email
**Key-Value Path** initial/admin_email
**Environment** NOC_INITIAL_ADMIN_EMAIL
**Default Value** test@example.com
================== =======================
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment