Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from ar-io/PE-6403-ao-configuration
Browse files Browse the repository at this point in the history
feat(ao): allow AO env variables to point process evaluation against …
  • Loading branch information
dtfiedler authored Jul 16, 2024
2 parents 46dbd29 + 5c19db2 commit 8d123d3
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
node-version-file: .nvmrc
cache: 'yarn'
- run: yarn --immutable --immutable-cache
- run: yarn --immutable --immutable-cache --ignore-engines
- run: yarn
- run: yarn ${{ matrix.step }}

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM node:${NODE_VERSION}-bullseye-slim AS builder
# Build
WORKDIR /app
COPY . .
RUN yarn && yarn build
RUN yarn --ignore-engines && yarn build
RUN rm-rf node_modules & yarn install --force

# Runtime
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"url": "https://github.com/ar-io/arns-resolver"
},
"dependencies": {
"@ar.io/sdk": "^2.0.0",
"@ar.io/sdk": "^2.0.2",
"@permaweb/aoconnect": "^0.0.56",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"express": "^4.18.2",
Expand Down
7 changes: 7 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ export const ARNS_CACHE_PATH = env.varOrDefault(
'./data/arns',
);
export const PORT = +env.varOrDefault('PORT', '6000');

// AO

export const AO_MU_URL = env.varOrUndefined('AO_MU_URL');
export const AO_CU_URL = env.varOrUndefined('AO_CU_URL');
export const AO_GRAPHQL_URL = env.varOrUndefined('AO_GRAPHQL_URL');
export const AO_GATEWAY_URL = env.varOrUndefined('AO_GATEWAY_URL');
13 changes: 12 additions & 1 deletion src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
import {
ANT,
ANTRecord,
AOProcess,
AoIORead,
IO,
ProcessId,
fetchAllArNSRecords,
isLeasedArNSRecord,
} from '@ar.io/sdk/node';
import { connect } from '@permaweb/aoconnect';
import pLimit from 'p-limit';

import { LmdbKVStore } from './cache/lmdb-kv-store.js';
Expand All @@ -36,7 +38,16 @@ let evaluationInProgress = false;
export const getLastEvaluatedTimestamp = () => lastEvaluationTimestamp;
export const isEvaluationInProgress = () => evaluationInProgress;
export const contract: AoIORead = IO.init({
processId: config.IO_PROCESS_ID,
process: new AOProcess({
processId: config.IO_PROCESS_ID,
ao: connect({
// @permaweb/aoconnect defaults will be used if these are not provided
MU_URL: config.AO_MU_URL,
CU_URL: config.AO_CU_URL,
GRAPHQL_URL: config.AO_GATEWAY_URL,
GATEWAY_URL: config.AO_GATEWAY_URL,
}),
}),
});

// TODO: this could be done using any KV store - or in memory. For now, we are using LMDB for persistence.
Expand Down
22 changes: 18 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
call-me-maybe "^1.0.1"
js-yaml "^4.1.0"

"@ar.io/sdk@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@ar.io/sdk/-/sdk-2.0.0.tgz#8725d1ece71b19dd7bfe44e846190bd458164206"
integrity sha512-at40lht1K6BOegoHoTezgL3z8y+Wj3VTEHMjNcoAywAV4R5l69xOTkJqEDL1uyLahspmxYGgX7rf50XFaVxMOw==
"@ar.io/sdk@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@ar.io/sdk/-/sdk-2.0.2.tgz#64aa7c4e6b30bbe36d7cc7d450f32d100ee731b3"
integrity sha512-DGSHo9Bf90Pe2m4lBEJPFuUageAaoO+nA42nhGJ2vCn6dKVM/y3aSqCJ+H5enHjidx0H1MmsgysiBQGEBElMHg==
dependencies:
"@permaweb/aoconnect" "^0.0.55"
arbundles "0.11.0"
Expand Down Expand Up @@ -1298,6 +1298,20 @@
warp-arbundles "^1.0.4"
zod "^3.22.4"

"@permaweb/aoconnect@^0.0.56":
version "0.0.56"
resolved "https://registry.yarnpkg.com/@permaweb/aoconnect/-/aoconnect-0.0.56.tgz#28dcf1a094a2b1c1cbaa246d63eeb08a5a0c7269"
integrity sha512-Eu4AC1KeX2EOIS9ihWkwPJs7rK+/+XV43QwOJ9DCQAu6EhjanlT3UfV2wSpGiFK/dT/B1YsQyTcxNrmQaXn81g==
dependencies:
"@permaweb/ao-scheduler-utils" "~0.0.16"
buffer "^6.0.3"
debug "^4.3.4"
hyper-async "^1.1.2"
mnemonist "^0.39.8"
ramda "^0.29.1"
warp-arbundles "^1.0.4"
zod "^3.22.4"

"@randlabs/[email protected]":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz#d1ecfc29157afcbb0ca2d73122d67905eecb5bf3"
Expand Down

0 comments on commit 8d123d3

Please sign in to comment.