Skip to content

Commit

Permalink
fix: update default value imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Dec 12, 2023
1 parent d846cd2 commit 8437cdd
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 32 deletions.
48 changes: 27 additions & 21 deletions cli/src/datafeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ import {
listHandler as reporterListHandler,
removeHandler as reporterRemoveHandler
} from './reporter'
import {
FETCHER_HOST,
FETCHER_PORT,
LISTENER_SERVICE_HOST,
LISTENER_SERVICE_PORT,
REPORTER_SERVICE_HOST,
REPORTER_SERVICE_PORT,
WORKER_SERVICE_HOST,
WORKER_SERVICE_PORT
} from './settings'
import { isValidUrl, loadJsonFromUrl } from './utils'

export function datafeedSub() {
Expand Down Expand Up @@ -231,17 +241,15 @@ export function bulkActivateHandler() {
const chain = bulkData?.chain || 'localhost'
const service = bulkData?.service || 'DATA_FEED'

const fetcherHost = bulkData?.fetcherHost || 'http://fetcher.orakl.svc.cluster.local'
const workerHost = bulkData?.workerHost || 'http://aggregator-worker.orakl.svc.cluster.local'
const listenerHost =
bulkData?.listenerHost || 'http://aggregator-listener.orakl.svc.cluster.local'
const reporterHost =
bulkData?.reporterHost || 'http://aggregator-reporter.orakl.svc.cluster.local'
const fetcherHost = bulkData?.fetcherHost || FETCHER_HOST
const workerHost = bulkData?.workerHost || WORKER_SERVICE_HOST
const listenerHost = bulkData?.listenerHost || LISTENER_SERVICE_HOST
const reporterHost = bulkData?.reporterHost || REPORTER_SERVICE_HOST

const fetcherPort = bulkData?.fetcherPort || '4040'
const workerPort = bulkData?.workerPort || '5000'
const listenerPort = bulkData?.listenerPort || '4000'
const reporterPort = bulkData?.reporterPort || '6000'
const fetcherPort = bulkData?.fetcherPort || FETCHER_PORT
const workerPort = bulkData?.workerPort || WORKER_SERVICE_PORT
const listenerPort = bulkData?.listenerPort || LISTENER_SERVICE_PORT
const reporterPort = bulkData?.reporterPort || REPORTER_SERVICE_PORT

const listeners = await listenerListHandler()({ chain, service })
const reporters = await reporterListHandler()({ chain, service })
Expand Down Expand Up @@ -311,17 +319,15 @@ export function bulkDeactivateHandler() {
const chain = bulkData?.chain || 'localhost'
const service = bulkData?.service || 'DATA_FEED'

const fetcherHost = bulkData?.fetcherHost || 'http://fetcher.orakl.svc.cluster.local'
const workerHost = bulkData?.workerHost || 'http://aggregator-worker.orakl.svc.cluster.local'
const listenerHost =
bulkData?.listenerHost || 'http://aggregator-listener.orakl.svc.cluster.local'
const reporterHost =
bulkData?.reporterHost || 'http://aggregator-reporter.orakl.svc.cluster.local'

const fetcherPort = bulkData?.fetcherPort || '4040'
const workerPort = bulkData?.workerPort || '5000'
const listenerPort = bulkData?.listenerPort || '4000'
const reporterPort = bulkData?.reporterPort || '6000'
const fetcherHost = bulkData?.fetcherHost || FETCHER_HOST
const workerHost = bulkData?.workerHost || WORKER_SERVICE_HOST
const listenerHost = bulkData?.listenerHost || LISTENER_SERVICE_HOST
const reporterHost = bulkData?.reporterHost || REPORTER_SERVICE_HOST

const fetcherPort = bulkData?.fetcherPort || FETCHER_PORT
const workerPort = bulkData?.workerPort || WORKER_SERVICE_PORT
const listenerPort = bulkData?.listenerPort || LISTENER_SERVICE_PORT
const reporterPort = bulkData?.reporterPort || REPORTER_SERVICE_PORT

const listeners = await listenerListHandler()({ chain, service })
const reporters = await reporterListHandler()({ chain, service })
Expand Down
49 changes: 38 additions & 11 deletions cli/src/settings.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
export const ORAKL_NETWORK_API_URL =
process.env.ORAKL_NETWORK_API_URL || 'http://localhost:3000/api/v1'
const production = process.env.NODE_ENV == 'production'
const default_api_url = production
? 'http://api.orakl.svc.cluster.local'
: 'http://localhost:3000/api/v1'
const default_delegator_url = production
? 'http://delegator.orakl.svc.cluster.local'
: 'http://localhost:3002/api/v1'

const default_fetcher_host = production
? 'http://fetcher.orakl.svc.cluster.local'
: 'http://localhost'
const default_fetcher_port = production ? '4040' : '3001'

const default_listener_host = production
? 'http://aggregator-listener.orakl.svc.cluster.local'
: 'http://localhost'
const default_listener_port = production ? '4000' : '4000'

const default_worker_host = production
? 'http://aggregator-worker.orakl.svc.cluster.local'
: 'http://localhost'
const default_worker_port = production ? '5000' : '5001'

const default_reporter_host = production
? 'http://aggregator-reporter.orakl.svc.cluster.local'
: 'http://localhost'
const default_reporter_port = production ? '6000' : '6000'

export const ORAKL_NETWORK_API_URL = process.env.ORAKL_NETWORK_API_URL || default_api_url
export const ORAKL_NETWORK_DELEGATOR_URL =
process.env.ORAKL_NETWORK_DELEGATOR_URL || 'http://localhost:3002/api/v1'
process.env.ORAKL_NETWORK_DELEGATOR_URL || default_delegator_url

export const FETCHER_HOST = 'http://localhost'
export const FETCHER_PORT = 3001
export const FETCHER_HOST = process.env.FETCHER_HOST || default_fetcher_host
export const FETCHER_PORT = process.env.FETCHER_PORT || default_fetcher_port
export const FETCHER_API_VERSION = '/api/v1'

export const LISTENER_SERVICE_HOST = process.env.LISTENER_SERVICE_HOST || 'http://localhost'
export const LISTENER_SERVICE_PORT = process.env.LISTENER_SERVICE_PORT || 4000
export const LISTENER_SERVICE_HOST = process.env.LISTENER_SERVICE_HOST || default_listener_host
export const LISTENER_SERVICE_PORT = process.env.LISTENER_SERVICE_PORT || default_listener_port

export const WORKER_SERVICE_HOST = process.env.WORKER_SERVICE_HOST || 'http://localhost'
export const WORKER_SERVICE_PORT = process.env.WORKER_SERVICE_PORT || 5001
export const WORKER_SERVICE_HOST = process.env.WORKER_SERVICE_HOST || default_worker_host
export const WORKER_SERVICE_PORT = process.env.WORKER_SERVICE_PORT || default_worker_port

export const REPORTER_SERVICE_HOST = process.env.REPORTER_SERVICE_HOST || 'http://localhost'
export const REPORTER_SERVICE_PORT = process.env.REPORTER_SERVICE_PORT || 6000
export const REPORTER_SERVICE_HOST = process.env.REPORTER_SERVICE_HOST || default_reporter_host
export const REPORTER_SERVICE_PORT = process.env.REPORTER_SERVICE_PORT || default_reporter_port

0 comments on commit 8437cdd

Please sign in to comment.