in cartography/driftdetect/cli.py [0:0]
def configure(self, argv):
"""
Entrypoint for the command line interface.
:type argv: string
:param argv: The parameters supplied to the command line program.
"""
# TODO support parameter lookup in environment variables if not present on command line
config = self.parser.parse_args(argv)
if config.verbose:
logging.getLogger('driftdetect').setLevel(logging.DEBUG)
elif config.quiet:
logging.getLogger('driftdetect').setLevel(logging.WARNING)
else:
logging.getLogger('driftdetect').setLevel(logging.INFO)
logger.debug("Launching driftdetect with CLI configuration: %r", vars(config))
if config.neo4j_user:
config.neo4j_password = None
if config.neo4j_password_prompt:
logger.info("Reading password for Neo4j user '%s' interactively.", config.neo4j_user)
config.neo4j_password = getpass.getpass()
elif config.neo4j_password_env_var:
logger.debug(
"Reading password for Neo4j user '%s' from environment variable '%s'.",
config.neo4j_user,
config.neo4j_password_env_var
)
config.neo4j_password = os.environ.get(config.neo4j_password_env_var)
if not config.neo4j_password:
logger.warning("Neo4j username was provided but a password could not be found.")
else:
config.neo4j_password = None
return config