Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP-to-CD mirroring #821

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

trustin
Copy link
Member

@trustin trustin commented Mar 13, 2023

Motivation:

It would be very useful to set up a simple mirror that mirrors the
result of an HTTP query into a repository, just like IFTTT.

Modifications:

  • Added support for the following two new URL schemes:
    • http
    • https
  • Renamed Mirror.remotePath to remoteSubpath to better reflect what
    it actually does.
  • Made Mirror.remoteSubpath nullable because HTTP-to-CD mirror doesn't
    need it.
  • Added HttpMirror and HttpMirrorTest.

Result:

Future works:

  • Add support for basic and token-based authentication
  • Add documentation

Motivation:

It would be very useful to set up a simple mirror that mirrors the
result of an HTTP query into a repository, just like IFTTT.

Modifications:

- Added support for the following two new URL schemes:
  - `http`
  - `https`
- Renamed `Mirror.remotePath` to `remoteSubpath` to better reflect what
  it actually does.
- Made `Mirror.remoteSubpath` nullable because HTTP-to-CD mirror doesn't
  need it.
- Added `HttpMirror` and `HttpMirrorTest`.

Result:

- A user can mirror a certain HTTP endpoint into a file in Central Dogma.
- Closes line#154

Future works:

- Add support for basic and token-based authentication
- Add documentation
Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good all in all.
We also need to fix the test here:

"localRepo=bar,remoteBranch=master,remotePath=/,success=true}", 1.0));

Thanks!

executor.execute(Command.push(
MIRROR_AUTHOR, localRepo().parent().name(), localRepo().name(),
Revision.HEAD, summary, "", Markup.PLAINTEXT,
Change.ofTextUpsert(localPath(), content))).join();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about raising an exception before creating HttpMirror if localPath is a directory?

public static final String SCHEME_HTTP = "http";

/**
* {@code "http"}.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this annotation has a typo!

Suggested change
* {@code "http"}.
* {@code "https"}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP API to CD mirroring
3 participants