Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add policyServerPassthrough routes #832

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ returns an empty object if it is valid otherwise an array with error
| ---------- | -------- | -------- | ------------------------------------------------- |
| command | string | v | command name |
| node | string | | if not present it means current node |
| multiAddrs | string[] | | if passed, use this instead of peerStore & DHT |
| multiAddrs | string[] | | if passed, use this instead of peerStore & DHT |
| id | string | v | document id or did |
| chainId | number | v | chain id of network on which document is provided |
| nftAddress | string | v | address of nft token |
Expand Down Expand Up @@ -1161,7 +1161,7 @@ returns the current indexing queue, as an array of objects

## PolicyServer Passthrough

### `HTTP` POST /PolicyServerPassthrough
### `HTTP` POST /api/services/PolicyServerPassthrough

### `P2P` command: PolicyServerPassthrough

Expand Down
4 changes: 3 additions & 1 deletion src/components/httpRoutes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { queueRoutes } from './queue.js'
// import { getConfiguration } from '../../utils/config.js'
import { jobsRoutes } from './jobs.js'
import { addMapping, allRoutesMapping, findPathName } from './routeUtils.js'
import { PolicyServerPassthroughRoute } from './policyServer.js'

export * from './getOceanPeers.js'

Expand Down Expand Up @@ -57,7 +58,8 @@ httpRoutes.use(computeRoutes)
httpRoutes.use(queueRoutes)
// running jobs
httpRoutes.use(jobsRoutes)

// policy server passthrough
httpRoutes.use(PolicyServerPassthroughRoute)
export function getAllServiceEndpoints() {
httpRoutes.stack.forEach(addMapping.bind(null, []))
const data: any = {}
Expand Down
5 changes: 5 additions & 0 deletions src/components/httpRoutes/routeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ routesNames.set('indexQueue', {
method: 'get'
})

routesNames.set('PolicyServerPassthrough', {
path: `${SERVICES_API_BASE_PATH}/PolicyServerPassthrough`,
method: 'post'
})

export function addMapping(path: any, layer: any) {
if (layer.route) {
layer.route.stack.forEach(addMapping.bind(null, path.concat(split(layer.route.path))))
Expand Down
Loading