How to use the publish.config.Config.get_instance function in publish

To help you get started, we’ve selected a few publish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AuHau / ipfs-publish / publish / republisher.py View on Github external
def republishing(db: PublishingDatabase, iterations: typing.Optional[int] = None):
    config = config_module.Config.get_instance()

    while iterations is None or iterations > 0:
        for repo in config.repos.values():
            if repo.republish and db.should_repo_publish(repo):
                logger.info(f'Publishing repo {repo.name}')
                repo.publish_name()
                db.published(repo)

        if db.data_changed:
            db.save()
        time.sleep(SLEEP_BETWEEN_CHECKS)

        if iterations is not None:
            iterations -= 1
github AuHau / ipfs-publish / publish / cli.py View on Github external
def cli(ctx, quiet, verbose, config):
    """
    Management interface for ipfs_publish, that allows adding/listing/removing supported repos.

    Currently only public repositories are allowed. There is support for generic Git provider, that has to have at least
    support for webhooks. There is also specific implementation for GitHub provider as it can sign the webhook's request
    with secret.

    The tool ships with HTTP server, that needs to be running to accept the webhook's calls.
    """
    helpers.setup_logging(-1 if quiet else verbose)

    ctx.obj['config'] = config_module.Config.get_instance(pathlib.Path(config) if config else None)
github AuHau / ipfs-publish / publish / http.py View on Github external
async def publish_endpoint(repo_name):
    """
    Endpoint for Git provider's webhook

    :param repo_name:
    :return:
    """
    config = config_module.Config.get_instance()
    if repo_name not in config.repos:
        abort(400)

    repo = config.repos[repo_name]
    handler = handler_dispatcher(repo)

    resp = await handler.handle_request(request)

    config.save()
    return resp