Merge pull request #14 from kevgliss/master
A few misc fixes found during testing.
This commit is contained in:
commit
92a3c1a5a0
|
@ -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
|
||||
administer Lemur.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ lemur db init
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ lemur init
|
||||
|
|
|
@ -62,8 +62,3 @@ def configure_hook(app):
|
|||
response.status_code = 403
|
||||
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,11 @@ def configure_app(app, config=None):
|
|||
except RuntimeError:
|
||||
if config and config != 'None':
|
||||
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")))
|
||||
else:
|
||||
app.config.from_object(from_file(os.path.join(os.getcwd(), 'default.conf.py')))
|
||||
|
||||
if not app.config.get('ENCRYPTION_KEY'):
|
||||
raise NoEncryptionKeyFound
|
||||
|
||||
|
||||
def configure_extensions(app):
|
||||
|
|
|
@ -333,6 +333,7 @@ class InitializeApp(Command):
|
|||
else:
|
||||
sys.stdout.write("[-] Default user has already been created, skipping...!\n")
|
||||
|
||||
if current_app.app.config.get('AWS_ACCOUNT_MAPPINGS'):
|
||||
for account_name, account_number in current_app.config.get('AWS_ACCOUNT_MAPPINGS').items():
|
||||
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))
|
||||
|
||||
|
||||
@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):
|
||||
"""
|
||||
This is the main Lemur server, it runs the flask app with gunicorn and
|
||||
|
@ -494,6 +475,26 @@ class LemurServer(Command):
|
|||
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():
|
||||
manager.add_command("start", LemurServer())
|
||||
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("sync", Sync())
|
||||
manager.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue