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

Switch to using the nuget pkg proxy #1

Merged
merged 1 commit into from
Feb 1, 2024
Merged

Conversation

ljoonal
Copy link
Member

@ljoonal ljoonal commented Feb 1, 2024

This way we don't need to have world readable GHA tokens, handled by the proxy instead. If me/my reverse proxy ever goes offline can be replaced quite easily, just need nginx and a domain:

http {
  map $request_uri $first_slash_path {
    "~/(?<p>[^/]+)/" $p;
  }
  ...
}

And the server block;

server {
  server_name pkg.munally.com;
  include tls/munally.conf;
  include errors.conf;

  location / {
    add_header Content-Type text/html;
    return 200 '<ul><li><a href="https://pkg.munally.com/MonkeyModdingTroop/index.json">MonkeyModdingTroop</a></li><li><a href="https://pkg.munally.com/ResoniteModdingGroup/index.json">ResoniteModdingGroup</a></li><li><a href="https://pkg.munally.com/LJ/index.json">com.munally.lj</a></li></ul>';
  }

  location ~^/(MonkeyModdingTroop|ResoniteModdingGroup)(/|$) {
    proxy_pass https://nuget.pkg.github.com$request_uri;
    proxy_set_header Authorization "Basic base64(user:token)";
    sub_filter "https://nuget.pkg.github.com/$first_slash_path" "https://pkg.munally.com/$first_slash_path";
    sub_filter_last_modified on;
    sub_filter_types application/json;
    sub_filter_once off;
  }

  location /LJ {
    proxy_pass https://nuget.pkg.github.com/ResoniteModdingGroup;
    sub_filter "https://.../api/packages/..." "https://pkg.munally.com/LJ";
    sub_filter_last_modified on;
    sub_filter_types application/json;
    sub_filter_once off;
  }
}

For anyone else reading this later on: feel free to use the proxy, but please don't try to abuse it, as I don't really feel like implementing caching to deal with rate limits :'D

  <PropertyGroup>
    <RestoreAdditionalProjectSources>https://pkg.munally.com/MonkeyModdingTroop/index.json;https://pkg.munally.com/ResoniteModdingGroup/index.json</RestoreAdditionalProjectSources>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MonkeyLoader" Version="0.3.0-beta" />
    <PackageReference Include="MonkeyLoader.GamePacks.Unity" Version="0.3.0-beta" />
  </ItemGroup>

@ljoonal ljoonal added the enhancement New feature or request label Feb 1, 2024
@ljoonal ljoonal requested a review from Banane9 February 1, 2024 17:30
@ljoonal ljoonal marked this pull request as draft February 1, 2024 17:37
@ljoonal ljoonal marked this pull request as ready for review February 1, 2024 17:39
@Banane9 Banane9 merged commit 64662c0 into master Feb 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants