Skip to content

Commit

Permalink
feat: add scaleway pinning service (#333)
Browse files Browse the repository at this point in the history
* feat(psa): add Scaleway into ci/psa

* fix(env-copy): scaleway endpoint

* fix: fetch no longer hangs during checkEmptyBearerToken with scaleway

* chore: remove debugging code

---------

Co-authored-by: Valentin Macheret <vmacheret@scaleway.com>
  • Loading branch information
SgtPooki and vmscw authored Sep 12, 2023
1 parent 667ad08 commit ae3a975
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env-copy
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ NFT_API_TOKEN=
FOREVERLAND_API_ENDPOINT=https://api.4everland.dev
FOREVERLAND_API_TOKEN=

SCALEWAY_API_ENDPOINT=https://pl-waw.ipfs.labs.scw.cloud/
SCALEWAY_API_TOKEN=

NODE_ENV=development
21 changes: 21 additions & 0 deletions .github/workflows/build-reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,24 @@ jobs:
with:
name: 4everland-report
path: docs/api.4everland.dev.md

check-scaleway-compliance:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- uses: ipfs/aegir/actions/cache-node-modules@master
- name: Reports Cache
uses: actions/cache@v3
with:
path: docs
key: ${{ github.sha }}-scaleway
- run: npm run dev-start -- -s ${{ secrets.SCALEWAY_API_ENDPOINT }} ${{secrets.SCALEWAY_API_TOKEN}}
- uses: actions/upload-artifact@v3
with:
name: scaleway-logs
path: docs/pl-waw.ipfs.labs.scw.cloud
- uses: actions/upload-artifact@v3
with:
name: scaleway-report
path: docs/pl-waw.ipfs.labs.scw.cloud.md
5 changes: 5 additions & 0 deletions .github/workflows/publish-reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
with:
path: docs
key: ${{ github.sha }}-4everland
- name: Reports Cache
uses: actions/cache@v3
with:
path: docs
key: ${{ github.sha }}-scaleway
- name: Scheduled deployment
uses: s0/git-publish-subdir-action@92faf786f11dfa44fc366ac3eb274d193ca1af7e
env:
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Periodically tested:
* [web3.storage](./api.web3.storage.md)
* [nft.storage](./nft.storage.md)
* [4EVERLAND](./api.4everland.dev.md)
* [Scaleway](./fr-par.ipfs.labs.scw.cloud.md)

Want to add your service to the list? [Open an issue](https://github.com/ipfs-shipyard/pinning-service-compliance/issues/new).

Expand Down
11 changes: 10 additions & 1 deletion src/clientFromServiceAndTokenPair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ import type { ServiceAndTokenPair } from './types.js'

function clientFromServiceAndTokenPair ([endpointUrl, accessToken]: ServiceAndTokenPair, middleWareOptions?: Omit<RequestResponseLoggerOptions, 'pair'>): RemotePinningServiceClient {
const requestResponseLoggerOptions: RequestResponseLoggerOptions = { ...middleWareOptions, pair: [endpointUrl, accessToken] }

const config = new Configuration({
endpointUrl,
accessToken,
fetchApi: fetch,
fetchApi: async (url: RequestInfo | URL, init?: RequestInit) => {
const abortController = new AbortController()
const { signal } = abortController
setTimeout(() => abortController.abort(), 60000)
return await fetch(url, {
...init,
signal: init?.signal ?? signal
})
},
middleware: [
requestResponseLogger(requestResponseLoggerOptions)
]
Expand Down

0 comments on commit ae3a975

Please sign in to comment.