Skip to content

Commit

Permalink
fix: proper envs and update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Aug 25, 2022
1 parent 79200a2 commit d5dccb6
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
with:
apiToken: ${{ secrets.CF_TOKEN }}
workingDirectory: 'packages/access-api'
environment: ${{ contains(fromJson('["production", "staging"]'), github.event.inputs.environment) && github.event.inputs.environment || null }}
environment: github.event.inputs.environment
secrets: |
POSTMARK_TOKEN
PRIVATE_KEY
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lint-staged": "^13.0.3",
"prettier": "2.7.1",
"simple-git-hooks": "^2.8.0",
"wrangler": "^2.0.26"
"wrangler": "^2.0.27"
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
Expand Down
8 changes: 4 additions & 4 deletions packages/access-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@
"@sentry/webpack-plugin": "^1.16.0",
"@types/assert": "^1.5.6",
"@types/git-rev-sync": "^2.0.0",
"@types/node": "^18.7.6",
"@types/node": "^18.7.13",
"assert": "^2.0.0",
"ava": "^4.3.0",
"ava": "^4.3.3",
"buffer": "^6.0.3",
"delay": "^5.0.0",
"dotenv": "^16.0.0",
"esbuild": "^0.15.5",
"execa": "^6.1.0",
"git-rev-sync": "^3.0.1",
"hd-scripts": "^2.0.1",
"miniflare": "^2.5.0",
"miniflare": "^2.7.1",
"process": "^0.11.10",
"readable-stream": "^4.1.0",
"sade": "^1.7.4",
"typescript": "4.7.4",
"wrangler": "^2.0.26"
"wrangler": "^2.0.27"
},
"eslintConfig": {
"extends": [
Expand Down
1 change: 0 additions & 1 deletion packages/access-api/src/bindings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export {}
declare global {
const ACCOUNTS: KVNamespace
const VALIDATIONS: KVNamespace
const BUCKET: R2Bucket
}

export interface RouteContext {
Expand Down
2 changes: 0 additions & 2 deletions packages/access-api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import { errorHandler } from '@web3-storage/worker-utils/error'
import { notFound } from '@web3-storage/worker-utils/response'
import { Router } from '@web3-storage/worker-utils/router'
import { validate } from './routes/validate.js'
import { upload } from './routes/upload.js'

/** @type Router<import('./bindings.js').RouteContext> */
const r = new Router({ onNotFound: notFound })
r.add('options', '*', preflight)
r.add('get', '/version', version)
r.add('post', '/upload', upload)

r.add('get', '/validate', validate)
r.add('post', '/', async (request, env) => {
Expand Down
22 changes: 0 additions & 22 deletions packages/access-api/src/routes/upload.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/access-api/src/routes/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ export function version(event, env) {
commit: env.config.COMMITHASH,
branch: env.config.BRANCH,
did: env.keypair.did(),
dsn: env.config.SENTRY_DSN,
})
}
57 changes: 47 additions & 10 deletions packages/access-api/wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development

name = "auth-dev"
name = "w3access-test"
account_id = "fffa4b4363a7e5250af8357087263b3a"
main = "./dist/worker.js"

Expand All @@ -9,19 +9,13 @@ compatibility_date = "2022-06-26"
compatibility_flags = ["url_standard"]
no_bundle = true

[[r2_buckets]]
binding = "BUCKET"
bucket_name = "access-test"

[[kv_namespaces]]
binding = "ACCOUNTS"
id = "e9fad7e04b254bf49206e08e50074387"
preview_id = "e9fad7e04b254bf49206e08e50074387"

[[kv_namespaces]]
binding = "VALIDATIONS"
id = "62e57652625c44a3b1fef2f840ffc882"
preview_id = "62e57652625c44a3b1fef2f840ffc882"

[vars]
ENV = "dev"
Expand All @@ -31,12 +25,55 @@ DEBUG = "true"
command = "scripts/cli.js build"
watch_dir = "src"

[miniflare]
r2_persist = "./data/" # Defaults to ./.mf/r2

# Dev
[env.dev]
name = "w3access-dev"
workers_dev = true

[env.dev.vars]
ENV = "dev"
DEBUG = "false"

[env.dev.build]
command = "scripts/cli.js build --env dev"
watch_dir = "src"

[[env.dev.kv_namespaces]]
binding = "ACCOUNTS"
id = "e9fad7e04b254bf49206e08e50074387"

[[env.dev.kv_namespaces]]
binding = "VALIDATIONS"
id = "62e57652625c44a3b1fef2f840ffc882"

# Staging
[env.staging]
name = "w3access-staging"
routes = [{ pattern = "access-api-stating.web3.storage", custom_domain = true }]

[env.staging.vars]
ENV = "staging"
DEBUG = "false"

[env.staging.build]
command = "scripts/cli.js build --env staging"
watch_dir = "src"

# TODO make new KV for prod
[[env.staging.kv_namespaces]]
binding = "ACCOUNTS"
id = "e9fad7e04b254bf49206e08e50074387"

[[env.staging.kv_namespaces]]
binding = "VALIDATIONS"
id = "62e57652625c44a3b1fef2f840ffc882"


# Production
[env.production]
routes = [{ pattern = "access.web3.storage", custom_domain = true }]
name = "w3access"
routes = [{ pattern = "access-api.web3.storage", custom_domain = true }]

[env.production.vars]
ENV = "production"
Expand Down
4 changes: 2 additions & 2 deletions packages/access/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
"conf": "^10.1.2",
"ora": "^6.1.2",
"p-retry": "^5.1.1",
"undici": "^5.9.1"
"undici": "^5.10.0"
},
"devDependencies": {
"@types/assert": "^1.5.6",
"@types/mocha": "^9.1.1",
"@types/node": "^18.7.6",
"@types/node": "^18.7.13",
"assert": "^2.0.0",
"hd-scripts": "^2.0.1",
"mocha": "^10.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "^18.7.6",
"@types/node": "^18.7.13",
"@types/react": "^18.0.17",
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5",
"hd-scripts": "^2.0.1",
"typescript": "4.7.4",
"wrangler": "^2.0.26"
"wrangler": "^2.0.27"
},
"eslintConfig": {
"extends": [
Expand Down
Loading

0 comments on commit d5dccb6

Please sign in to comment.