Skip to content

Commit

Permalink
access-api configureSigner happens inside loadConfig and sets config.…
Browse files Browse the repository at this point in the history
…signer
  • Loading branch information
gobengo committed Dec 9, 2022
1 parent 795582a commit b9533c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/access-api/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ export function loadConfig(env) {
}
}

const DID = env.DID
const PRIVATE_KEY = vars.PRIVATE_KEY
const signer = configureSigner({ DID, PRIVATE_KEY })
return {
DEBUG: boolValue(vars.DEBUG),
ENV: parseRuntimeEnv(vars.ENV),

PRIVATE_KEY: vars.PRIVATE_KEY,
PRIVATE_KEY,
POSTMARK_TOKEN: vars.POSTMARK_TOKEN,
SENTRY_DSN: vars.SENTRY_DSN,
LOGTAIL_TOKEN: vars.LOGTAIL_TOKEN,
Expand All @@ -52,7 +55,8 @@ export function loadConfig(env) {
// eslint-disable-next-line no-undef
COMMITHASH: ACCOUNT_COMMITHASH,

DID: env.DID,
DID,
signer,

// bindings
METRICS:
Expand Down
6 changes: 2 additions & 4 deletions packages/access-api/src/utils/context.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Logging } from '@web3-storage/worker-utils/logging'
import Toucan from 'toucan-js'
import pkg from '../../package.json'
import { configureSigner, loadConfig } from '../config.js'
import { loadConfig } from '../config.js'
import { Spaces } from '../kvs/spaces.js'
import { Validations } from '../kvs/validations.js'
import { Email } from './email.js'
Expand Down Expand Up @@ -40,13 +40,11 @@ export function getContext(request, env, ctx) {
commit: config.COMMITHASH,
env: config.ENV,
})

const signer = configureSigner(config)
const url = new URL(request.url)
const db = new D1QB(config.DB)
return {
log,
signer,
signer: config.signer,
config,
url,
kvs: {
Expand Down

0 comments on commit b9533c9

Please sign in to comment.