Skip to content

Commit

Permalink
Tidy ozone config (bluesky-social#2589)
Browse files Browse the repository at this point in the history
remove entryway agent from ozone cfg
dholms authored Jun 18, 2024

Verified

This commit was signed with the committer’s verified signature.
broonie Mark Brown
1 parent 0576280 commit 3c76437
Showing 4 changed files with 4 additions and 40 deletions.
8 changes: 4 additions & 4 deletions packages/ozone/src/api/proxied.ts
Original file line number Diff line number Diff line change
@@ -145,12 +145,12 @@ export default function (server: Server, ctx: AppContext) {
server.com.atproto.admin.searchAccounts({
auth: ctx.authVerifier.moderator,
handler: async (request) => {
if (!ctx.entrywayAgent) {
throw new Error('Entryway not configured')
if (!ctx.pdsAgent) {
throw new Error('PDS not configured')
}
const res = await ctx.entrywayAgent.api.com.atproto.admin.searchAccounts(
const res = await ctx.pdsAgent.api.com.atproto.admin.searchAccounts(
request.params,
await ctx.entrywayAuth(),
await ctx.pdsAuth(),
)
return {
encoding: 'application/json',
16 changes: 0 additions & 16 deletions packages/ozone/src/config/config.ts
Original file line number Diff line number Diff line change
@@ -53,15 +53,6 @@ export const envToCfg = (env: OzoneEnvironment): OzoneConfig => {
}
}

let entrywayCfg: OzoneConfig['entryway'] = null
if (env.entrywayUrl || env.entrywayDid) {
assert(env.entrywayUrl && env.entrywayDid)
chatCfg = {
url: env.entrywayUrl,
did: env.entrywayDid,
}
}

const cdnCfg: OzoneConfig['cdn'] = {
paths: env.cdnPaths,
}
@@ -90,7 +81,6 @@ export const envToCfg = (env: OzoneEnvironment): OzoneConfig => {
appview: appviewCfg,
pds: pdsCfg,
chat: chatCfg,
entryway: entrywayCfg,
cdn: cdnCfg,
identity: identityCfg,
blobDivert: blobDivertServiceCfg,
@@ -104,7 +94,6 @@ export type OzoneConfig = {
appview: AppviewConfig
pds: PdsConfig | null
chat: ChatConfig | null
entryway: EntrywayConfig | null
cdn: CdnConfig
identity: IdentityConfig
blobDivert: BlobDivertConfig | null
@@ -148,11 +137,6 @@ export type ChatConfig = {
did: string
}

export type EntrywayConfig = {
url: string
did: string
}

export type CdnConfig = {
paths?: string[]
}
4 changes: 0 additions & 4 deletions packages/ozone/src/config/env.ts
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@ export const readEnv = (): OzoneEnvironment => {
pdsDid: envStr('OZONE_PDS_DID'),
chatUrl: envStr('OZONE_CHAT_URL'),
chatDid: envStr('OZONE_CHAT_DID'),
entrywayUrl: envStr('OZONE_ENTRYWAY_URL'),
entrywayDid: envStr('OZONE_ENTRYWAY_DID'),
dbPostgresUrl: envStr('OZONE_DB_POSTGRES_URL'),
dbPostgresSchema: envStr('OZONE_DB_POSTGRES_SCHEMA'),
dbPoolSize: envInt('OZONE_DB_POOL_SIZE'),
@@ -48,8 +46,6 @@ export type OzoneEnvironment = {
pdsDid?: string
chatUrl?: string
chatDid?: string
entrywayUrl?: string
entrywayDid?: string
dbPostgresUrl?: string
dbPostgresSchema?: string
dbPoolSize?: number
16 changes: 0 additions & 16 deletions packages/ozone/src/context.ts
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@ export type AppContextOptions = {
appviewAgent: AtpAgent
pdsAgent: AtpAgent | undefined
chatAgent: AtpAgent | undefined
entrywayAgent: AtpAgent | undefined
blobDiverter?: BlobDiverter
signingKey: Keypair
signingKeyId: number
@@ -72,9 +71,6 @@ export class AppContext {
const chatAgent = cfg.chat
? new AtpAgent({ service: cfg.chat.url })
: undefined
const entrywayAgent = cfg.entryway
? new AtpAgent({ service: cfg.entryway.url })
: undefined

const idResolver = new IdResolver({
plcUrl: cfg.identity.plcUrl,
@@ -131,7 +127,6 @@ export class AppContext {
appviewAgent,
pdsAgent,
chatAgent,
entrywayAgent,
signingKey,
signingKeyId,
idResolver,
@@ -185,10 +180,6 @@ export class AppContext {
return this.opts.chatAgent
}

get entrywayAgent(): AtpAgent | undefined {
return this.opts.entrywayAgent
}

get signingKey(): Keypair {
return this.opts.signingKey
}
@@ -244,13 +235,6 @@ export class AppContext {
return this.serviceAuthHeaders(this.cfg.chat.did)
}

async entrywayAuth() {
if (!this.cfg.entryway) {
throw new Error('No entryway service configured')
}
return this.serviceAuthHeaders(this.cfg.entryway.did)
}

devOverride(overrides: Partial<AppContextOptions>) {
this.opts = {
...this.opts,

0 comments on commit 3c76437

Please sign in to comment.