Skip to content

Commit

Permalink
Merge pull request #832 from oceanprotocol/issue-831-policy
Browse files Browse the repository at this point in the history
add policyServerPassthrough routes
  • Loading branch information
paulo-ocean authored Feb 4, 2025
2 parents 2b84e26 + 547d987 commit 4582432
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
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

0 comments on commit 4582432

Please sign in to comment.