adjusted things for feedback/clarity
This commit is contained in:
Vendored
+1
-1
@@ -7,7 +7,7 @@ let cacheCursor: string | undefined
|
|||||||
|
|
||||||
export class EventCache {
|
export class EventCache {
|
||||||
private rules = new Map<string, ToolsOzoneSafelinkDefs.Event>()
|
private rules = new Map<string, ToolsOzoneSafelinkDefs.Event>()
|
||||||
private cfg: ServiceConfig | undefined = undefined
|
private cfg: ServiceConfig
|
||||||
private pollInterval = 1 * 1000 // start at 1 second
|
private pollInterval = 1 * 1000 // start at 1 second
|
||||||
|
|
||||||
constructor(cfg: ServiceConfig) {
|
constructor(cfg: ServiceConfig) {
|
||||||
|
|||||||
Vendored
+5
-5
@@ -5,12 +5,12 @@ import {type ServiceConfig} from '../config'
|
|||||||
export class OzoneAgent {
|
export class OzoneAgent {
|
||||||
public session: CredentialSession
|
public session: CredentialSession
|
||||||
public agent: AtpAgent
|
public agent: AtpAgent
|
||||||
private cfg?: ServiceConfig
|
private cfg: ServiceConfig
|
||||||
|
|
||||||
constructor(cfg: ServiceConfig) {
|
constructor(cfg: ServiceConfig) {
|
||||||
this.cfg = cfg
|
this.cfg = cfg
|
||||||
this.session = new CredentialSession(
|
this.session = new CredentialSession(
|
||||||
new URL(cfg?.ozoneUrl || 'http://localhost:2583'),
|
new URL(cfg.ozoneUrl || 'http://localhost:2583'),
|
||||||
)
|
)
|
||||||
this.agent = new AtpAgent(this.session)
|
this.agent = new AtpAgent(this.session)
|
||||||
}
|
}
|
||||||
@@ -23,14 +23,14 @@ export class OzoneAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async getAgent(): Promise<AtpAgent> {
|
public async getAgent(): Promise<AtpAgent> {
|
||||||
if (!this.cfg?.ozoneAgentHandle && !this.cfg?.ozoneAgentPass) {
|
if (!this.cfg.ozoneAgentHandle && !this.cfg.ozoneAgentPass) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'OZONE_AGENT_HANDLE and OZONE_AGENT_PASS environment variables must be set',
|
'OZONE_AGENT_HANDLE and OZONE_AGENT_PASS environment variables must be set',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const identifier = this.cfg?.ozoneAgentHandle || 'did:plc:invalid'
|
const identifier = this.cfg.ozoneAgentHandle || 'did:plc:invalid'
|
||||||
const password = this.cfg?.ozoneAgentPass || 'invalid'
|
const password = this.cfg.ozoneAgentPass || 'invalid'
|
||||||
|
|
||||||
if (!this.session.hasSession) {
|
if (!this.session.hasSession) {
|
||||||
await this.session.login({identifier, password})
|
await this.session.login({identifier, password})
|
||||||
|
|||||||
Reference in New Issue
Block a user