diff options
author | 2025-06-12 01:53:38 -0700 | |
---|---|---|
committer | 2025-06-12 01:53:38 -0700 | |
commit | c9adb09abc626cdcc35c345a635ad8c163fcff3e (patch) | |
tree | 93f78bf8e5910a044f96ed77aca498ac60ada804 /src/config.h | |
parent | 179679633a9fc3317585167f86c87a7fe8394945 (diff) | |
parent | b78875e2265339b58c7a67cc83e6db2988aa0d74 (diff) | |
download | github-mirror-c9adb09abc626cdcc35c345a635ad8c163fcff3e.tar.gz github-mirror-c9adb09abc626cdcc35c345a635ad8c163fcff3e.tar.zst github-mirror-c9adb09abc626cdcc35c345a635ad8c163fcff3e.zip |
Merge pull request #2 from ansg191/srht
Diffstat (limited to 'src/config.h')
-rw-r--r-- | src/config.h | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/config.h b/src/config.h index eb133b4..4d08b7a 100644 --- a/src/config.h +++ b/src/config.h @@ -8,7 +8,8 @@ #include <stdlib.h> #define GH_DEFAULT_ENDPOINT "https://api.github.com/graphql" -#define GH_DEFAULT_USER_AGENT "github-mirror/" GITHUB_MIRROR_VERSION +#define SRHT_DEFAULT_ENDPOINT "https://git.sr.ht/query" +#define DEFAULT_USER_AGENT "github-mirror/" GITHUB_MIRROR_VERSION extern const char *config_locations[]; @@ -29,8 +30,34 @@ struct github_cfg { // Owned /// Github auth token const char *token; - /// Next owner in the list - struct github_cfg *next; +}; + +struct srht_cfg { + // Borrowed + /// SourceHut graphql API endpoint + const char *endpoint; + /// Client user agent + const char *user_agent; + /// The owner of the repositories + const char *owner; + + // Owned + const char *token; +}; + +enum remote_type { + remote_type_github, + remote_type_srht, +}; + +struct remote_cfg { + enum remote_type type; + union { + struct github_cfg gh; + struct srht_cfg srht; + }; + /// Next remote in the list + struct remote_cfg *next; }; struct config { @@ -42,7 +69,7 @@ struct config { int quiet; /// Repo owners to mirror - struct github_cfg *head; + struct remote_cfg *head; /// The filepath to the git mirrors /// Default: /srv/git |