Merge pull request #15 from kevgliss/master
General cleanup and hotfixes
This commit is contained in:
commit
737d4d62d4
|
@ -100,6 +100,10 @@ used by Lemur to help associate certificates that do not currently have an owner
|
||||||
Lemur has discovered certificates from a third party resource. This is also a default user that can be used to
|
Lemur has discovered certificates from a third party resource. This is also a default user that can be used to
|
||||||
administer Lemur.
|
administer Lemur.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ lemur db init
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ lemur init
|
$ lemur init
|
||||||
|
|
|
@ -62,8 +62,3 @@ def configure_hook(app):
|
||||||
response.status_code = 403
|
response.status_code = 403
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
# This is just Python which means you can inherit and tweak settings
|
||||||
|
|
||||||
|
import os
|
||||||
|
_basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
ADMINS = frozenset([''])
|
||||||
|
|
||||||
|
THREADS_PER_PAGE = 8
|
||||||
|
|
||||||
|
#############
|
||||||
|
## General ##
|
||||||
|
#############
|
||||||
|
|
||||||
|
# These will need to be set to `True` if you are developing locally
|
||||||
|
CORS = False
|
||||||
|
debug = False
|
||||||
|
|
||||||
|
#############
|
||||||
|
## Logging ##
|
||||||
|
#############
|
||||||
|
|
||||||
|
LOG_LEVEL = "DEBUG"
|
||||||
|
LOG_FILE = "lemur.log"
|
||||||
|
|
|
@ -94,11 +94,10 @@ def configure_app(app, config=None):
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
if config and config != 'None':
|
if config and config != 'None':
|
||||||
app.config.from_object(from_file(config))
|
app.config.from_object(from_file(config))
|
||||||
else:
|
elif os.path.isfile(os.path.expanduser("~/.lemur/lemur.conf.py")):
|
||||||
app.config.from_object(from_file(os.path.expanduser("~/.lemur/lemur.conf.py")))
|
app.config.from_object(from_file(os.path.expanduser("~/.lemur/lemur.conf.py")))
|
||||||
|
else:
|
||||||
if not app.config.get('ENCRYPTION_KEY'):
|
app.config.from_object(from_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default.conf.py')))
|
||||||
raise NoEncryptionKeyFound
|
|
||||||
|
|
||||||
|
|
||||||
def configure_extensions(app):
|
def configure_extensions(app):
|
||||||
|
|
|
@ -333,6 +333,7 @@ class InitializeApp(Command):
|
||||||
else:
|
else:
|
||||||
sys.stdout.write("[-] Default user has already been created, skipping...!\n")
|
sys.stdout.write("[-] Default user has already been created, skipping...!\n")
|
||||||
|
|
||||||
|
if current_app.config.get('AWS_ACCOUNT_MAPPINGS'):
|
||||||
for account_name, account_number in current_app.config.get('AWS_ACCOUNT_MAPPINGS').items():
|
for account_name, account_number in current_app.config.get('AWS_ACCOUNT_MAPPINGS').items():
|
||||||
account = account_service.get_by_account_number(account_number)
|
account = account_service.get_by_account_number(account_number)
|
||||||
|
|
||||||
|
@ -439,26 +440,6 @@ class CreateRole(Command):
|
||||||
sys.stdout.write("[+] Created new role: {0}".format(name))
|
sys.stdout.write("[+] Created new role: {0}".format(name))
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
|
||||||
def create_config(config_path=None):
|
|
||||||
"""
|
|
||||||
Creates a new configuration file if one does not already exist
|
|
||||||
"""
|
|
||||||
if not config_path:
|
|
||||||
config_path = DEFAULT_CONFIG_PATH
|
|
||||||
|
|
||||||
config_path = os.path.expanduser(config_path)
|
|
||||||
dir = os.path.dirname(config_path)
|
|
||||||
if not os.path.exists(dir):
|
|
||||||
os.makedirs(dir)
|
|
||||||
|
|
||||||
config = generate_settings()
|
|
||||||
with open(config_path, 'w') as f:
|
|
||||||
f.write(config)
|
|
||||||
|
|
||||||
sys.stdout.write("Created a new configuration file {0}\n".format(config_path))
|
|
||||||
|
|
||||||
|
|
||||||
class LemurServer(Command):
|
class LemurServer(Command):
|
||||||
"""
|
"""
|
||||||
This is the main Lemur server, it runs the flask app with gunicorn and
|
This is the main Lemur server, it runs the flask app with gunicorn and
|
||||||
|
@ -494,6 +475,26 @@ class LemurServer(Command):
|
||||||
return app.run()
|
return app.run()
|
||||||
|
|
||||||
|
|
||||||
|
@manager.command
|
||||||
|
def create_config(config_path=None):
|
||||||
|
"""
|
||||||
|
Creates a new configuration file if one does not already exist
|
||||||
|
"""
|
||||||
|
if not config_path:
|
||||||
|
config_path = DEFAULT_CONFIG_PATH
|
||||||
|
|
||||||
|
config_path = os.path.expanduser(config_path)
|
||||||
|
dir = os.path.dirname(config_path)
|
||||||
|
if not os.path.exists(dir):
|
||||||
|
os.makedirs(dir)
|
||||||
|
|
||||||
|
config = generate_settings()
|
||||||
|
with open(config_path, 'w') as f:
|
||||||
|
f.write(config)
|
||||||
|
|
||||||
|
sys.stdout.write("Created a new configuration file {0}\n".format(config_path))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
manager.add_command("start", LemurServer())
|
manager.add_command("start", LemurServer())
|
||||||
manager.add_command("runserver", Server(host='127.0.0.1'))
|
manager.add_command("runserver", Server(host='127.0.0.1'))
|
||||||
|
@ -505,3 +506,7 @@ def main():
|
||||||
manager.add_command('create_role', CreateRole())
|
manager.add_command('create_role', CreateRole())
|
||||||
manager.add_command("sync", Sync())
|
manager.add_command("sync", Sync())
|
||||||
manager.run()
|
manager.run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in New Issue