Skip to content

Commit

Permalink
feat: can disable new user registration at /user/login API around w3u…
Browse files Browse the repository at this point in the history
…p launch by setting `NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START` (#2324)

Motivation:
* https://github.com/web3-storage/secrets/issues/22

What
* now that some stuff is needed as common between the two packages for
api and website, I moved the `w3up-launch` module into a new package
that both can depend on `@web3-storage/w3up-launch`
* `@web3-storage/api` `loginOrRegister` reads
env.`NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START` and if its
after that, will throw an error when it would otherwise create a new
user.
* website 'callback' page from magic link detects the error from POST
/user/login indicating this and redirects user to
`/login/signups-closed/try-w3up/`
  • Loading branch information
gobengo authored Nov 13, 2023
1 parent 3ad45ab commit 09a59c6
Show file tree
Hide file tree
Showing 29 changed files with 1,071 additions and 273 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: test
environment:
name: staging
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand All @@ -67,6 +69,9 @@ jobs:
ENV: 'staging' # inform the build process what the env is
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN}}
SENTRY_UPLOAD: ${{ secrets.SENTRY_UPLOAD}}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }}
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }}
with:
apiToken: ${{ secrets.CF_TOKEN }}
workingDirectory: 'packages/api'
Expand Down Expand Up @@ -100,6 +105,9 @@ jobs:
ENV: 'production' # inform the build process what the env is
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN}}
SENTRY_UPLOAD: ${{ secrets.SENTRY_UPLOAD}}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }}
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }}
with:
apiToken: ${{ secrets.CF_TOKEN }}
workingDirectory: 'packages/api'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ jobs:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.TESTING_STRIPE_PUBLISHABLE_KEY }}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }}
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }}
DID_DOCUMENT_ID: ${{ secrets.STAGING_DID_DOCUMENT_ID }}
DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.STAGING_DID_DOCUMENT_PRIMARY_DID_KEY }}
- name: Add to web3.storage
Expand Down Expand Up @@ -298,6 +299,7 @@ jobs:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_ANNOUNCEMENT_START }}
NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START }}
NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }}
DID_DOCUMENT_ID: ${{ secrets.PRODUCTION_DID_DOCUMENT_ID }}
DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.PRODUCTION_DID_DOCUMENT_PRIMARY_DID_KEY }}
- name: Add to web3.storage
Expand Down
Loading

0 comments on commit 09a59c6

Please sign in to comment.