Skip to content

Commit

Permalink
Attempting to fix build after #1389 was merged without it being updat…
Browse files Browse the repository at this point in the history
…ed to the latest from main

* Some cleaning of PSA_ALLOW references too
  • Loading branch information
jsdevel committed Mar 17, 2022
1 parent f8c3252 commit c3b93f8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ DAG_CARGO_PASSWORD=<db-password>



# Pinning services api, requires a PSA allow list for authoritzation
# this is the user id in the database
PSA_ALLOW=1
# Pinning services api, requires a user to have the HasPsaAccess user_tag.
```

Production vars should be set in Github Actions secrets.
Expand Down
1 change: 0 additions & 1 deletion packages/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ wrangler secret put CLUSTER_BASIC_AUTH_TOKEN --env production # Get from nft.sto
wrangler secret put CLUSTER_SERVICE --env production # Which cluster should be used. Options 'IpfsCluster' / 'IpfsCluster2' / 'IpfsCluster3'
wrangler secret put MAILCHIMP_API_KEY --env production # Get from mailchimp
wrangler secret put LOGTAIL_TOKEN --env production # Get from Logtail
wrangler secret put PSA_ALLOW --env production # CSV user ID list, get from 1password vault
wrangler secret put METAPLEX_AUTH_TOKEN --env production # User ID meteplex endpoint should use (not required for dev)
wrangler secret put S3_REGION --env production # e.g us-east-2 (not required for dev)
wrangler secret put S3_ACCESS_KEY_ID --env production # Get from Amazon S3 (not required for dev)
Expand Down
1 change: 0 additions & 1 deletion packages/api/src/bindings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ declare global {
const COMMITHASH: string
const MAINTENANCE_MODE: Mode
const METAPLEX_AUTH_TOKEN: string
const PSA_ALLOW: string
const S3_ENDPOINT: string
const S3_REGION: string
const S3_ACCESS_KEY_ID: string
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/middleware/psa.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export function withPinningAuthorized(handler) {
// TODO: we need withAuth middleware so we don't have to do this twice
const { user } = await validate(event, ctx)

console.error('test user', JSON.stringify(user, null, 2))

const authorized =
hasTag(user, 'HasPsaAccess', 'true') &&
!hasTag(user, 'HasAccountRestriction', 'true')
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ export async function createTestUserWithFixedToken({
tag: 'HasPsaAccess',
value: 'true',
reason: '',
inserted_at: '2/22/2022',
inserted_at: new Date().toISOString(),
})

await createUserTag({
user_id: user.id,
tag: 'HasAccountRestriction',
value: 'false',
reason: '',
inserted_at: '2/22/2022',
inserted_at: new Date().toISOString(),
})
return { token, userId: user.id, githubId: user.github_id }
}
Expand Down

0 comments on commit c3b93f8

Please sign in to comment.