"""Entrypoint to using m2mconfig tools.""" import logging import sentry_sdk import typer from m2mconfig import config from m2mconfig.cli.hello import hello_cli from m2mconfig.cli.lint import lint_cli from m2mconfig.cli.sync import sync_cli from m2mconfig.logging import configure_logging logger: logging.Logger = logging.getLogger(__name__) app: typer.Typer = typer.Typer(no_args_is_help=True, help="auth0-m2m-config CLI") app.add_typer(hello_cli, name="greetings") app.add_typer(lint_cli, name="lint") app.add_typer(sync_cli, name="sync", help="Tooling for synchronizing m2m.json") @app.callback() def setup() -> None: """Application Setup.""" configure_logging( logging_config=config.LOGGING_CONFIG, environment=config.ENVIRONMENT, service_name=config.SERVICE_NAME, logger_name=config.LOGGER_NAME, service_version=config.SERVICE_VERSION, ) if config.SENTRY: logger.info("SENTRY enabled") sentry_sdk.init( dsn=config.SENTRY, # Set traces_sample_rate to 1.0 to capture 100% # of transactions for tracing. traces_sample_rate=1.0, ) else: logger.info("SENTRY disabled") logger.debug("setup() complete.") def main() -> None: """m2mconfig cli command entrypoint.""" app() if __name__ == "__main__": main()