Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GÉANT Service Orchestrator GUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator GUI
Merge requests
!20
New GUI V2 structure
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
New GUI V2 structure
feature/NAT-556-gui-v2-new-structure
into
develop
Overview
14
Commits
4
Pipelines
26
Changes
1
All threads resolved!
Hide all comments
Merged
Mohammad Torkashvand
requested to merge
feature/NAT-556-gui-v2-new-structure
into
develop
1 year ago
Overview
14
Commits
4
Pipelines
26
Changes
1
All threads resolved!
Hide all comments
Expand
0
0
Merge request reports
Viewing commit
f245fd91
Prev
Next
Show latest version
1 file
+
43
−
37
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
f245fd91
make configration better and more readable
· f245fd91
Mohammad Torkashvand
authored
1 year ago
configuration/configuration.ts
+
43
−
37
Options
import
process
from
'
process
'
;
import
process
from
'
process
'
;
import
{
Environment
,
OrchestratorConfig
}
from
'
@orchestrator-ui/orchestrator-ui-components
'
;
import
{
// Default configurations
Environment
,
export
const
DEFAULT_GRAPHQL_CORE_ENDPOINT
=
'
http://localhost:8080/api/graphql
'
;
OrchestratorConfig
,
}
from
'
@orchestrator-ui/orchestrator-ui-components
'
;
export
const
DEFAULT_GRAPHQL_CORE_ENDPOINT
=
'
http://localhost:8080/api/graphql
'
;
export
const
DEFAULT_ORCHESTRATOR_API_BASE_URL
=
'
http://localhost:8080/api
'
;
export
const
DEFAULT_ORCHESTRATOR_API_BASE_URL
=
'
http://localhost:8080/api
'
;
export
const
DEFAULT_ORCHESTRATOR_WEBSOCKET_URL
=
'
ws://localhost:8080
'
;
export
const
DEFAULT_ORCHESTRATOR_WEBSOCKET_URL
=
'
ws://localhost:8080
'
;
export
const
ENGINE_STATUS_ENDPOINT
=
'
/settings/status
'
;
export
const
ENGINE_STATUS_ENDPOINT
=
'
/settings/status
'
;
export
const
PROCESSES_ENDPOINT
=
'
/processes
'
;
export
const
PROCESSES_ENDPOINT
=
'
/processes
'
;
export
const
SUBSCRIPTION_ACTIONS_ENDPOINT
=
'
/subscriptions/workflows
'
;
export
const
SUBSCRIPTION_ACTIONS_ENDPOINT
=
'
/subscriptions/workflows
'
;
export
const
SUBSCRIPTION_PROCESSES_ENDPOINT
=
export
const
SUBSCRIPTION_PROCESSES_ENDPOINT
=
'
/processes/process-subscriptions-by-subscription-id
'
;
'
/processes/process-subscriptions-by-subscription-id
'
;
export
const
DEFAULT_WORKFLOW_INFORMATION_LINK_URL
=
'
http://localhost:8080
'
;
export
const
DEFAULT_WORKFLOW_INFORMATION_LINK_URL
=
'
http://localhost:8080
'
;
interface
EnvConfig
{
ORCHESTRATOR_GRAPHQL_HOST
?:
string
;
ORCHESTRATOR_GRAPHQL_PATH
?:
string
;
ORCHESTRATOR_API_HOST
?:
string
;
ORCHESTRATOR_API_PATH
?:
string
;
ORCHESTRATOR_WEBSOCKET_URL
?:
string
;
ENVIRONMENT_NAME
?:
string
;
AUTH_ACTIVE
?:
string
;
USE_WEB_SOCKETS
?:
string
;
USE_THEME_TOGGLE
?:
string
;
WORKFLOW_INFORMATION_LINK_URL
?:
string
;
SHOW_WORKFLOW_INFORMATION_LINK
?:
string
;
}
const
getEnvValue
=
(
envVar
:
string
|
undefined
,
defaultValue
:
string
):
string
=>
envVar
||
defaultValue
;
const
getBooleanEnvValue
=
(
envVar
:
string
|
undefined
,
defaultValue
:
boolean
):
boolean
=>
envVar
?
envVar
.
toLowerCase
()
===
'
true
'
:
defaultValue
;
// Assemble the Orchestrator configuration from environment variables
export
const
getInitialOrchestratorConfig
=
():
OrchestratorConfig
=>
{
export
const
getInitialOrchestratorConfig
=
():
OrchestratorConfig
=>
{
const
orchestratorGraphqlBaseUrl
=
const
env
=
process
.
env
as
unknown
as
EnvConfig
;
process
.
env
.
ORCHESTRATOR_GRAPHQL_HOST
&&
process
.
env
.
ORCHESTRATOR_GRAPHQL_PATH
// Construct URLs based on environment or defaults
?
`
${
process
.
env
.
ORCHESTRATOR_GRAPHQL_HOST
}${
process
.
env
.
ORCHESTRATOR_GRAPHQL_PATH
}
`
const
orchestratorGraphqlBaseUrl
=
env
.
ORCHESTRATOR_GRAPHQL_HOST
&&
env
.
ORCHESTRATOR_GRAPHQL_PATH
:
DEFAULT_GRAPHQL_CORE_ENDPOINT
;
?
`
${
env
.
ORCHESTRATOR_GRAPHQL_HOST
}${
env
.
ORCHESTRATOR_GRAPHQL_PATH
}
`
:
DEFAULT_GRAPHQL_CORE_ENDPOINT
;
const
orchestratorApiBaseUrl
=
const
orchestratorApiBaseUrl
=
env
.
ORCHESTRATOR_API_HOST
&&
env
.
ORCHESTRATOR_API_PATH
process
.
env
.
ORCHESTRATOR_API_HOST
&&
process
.
env
.
ORCHESTRATOR_API_PATH
?
`
${
env
.
ORCHESTRATOR_API_HOST
}${
env
.
ORCHESTRATOR_API_PATH
}
`
?
`
${
process
.
env
.
ORCHESTRATOR_API_HOST
}${
process
.
env
.
ORCHESTRATOR_API_PATH
}
`
:
DEFAULT_ORCHESTRATOR_API_BASE_URL
;
:
DEFAULT_ORCHESTRATOR_API_BASE_URL
;
return
{
return
{
orchestratorApiBaseUrl
,
orchestratorApiBaseUrl
,
engineStatusEndpoint
:
orchestratorApiBaseUrl
+
ENGINE_STATUS_ENDPOINT
,
engineStatusEndpoint
:
orchestratorApiBaseUrl
+
ENGINE_STATUS_ENDPOINT
,
graphqlEndpointCore
:
orchestratorGraphqlBaseUrl
,
graphqlEndpointCore
:
orchestratorGraphqlBaseUrl
,
processesEndpoint
:
orchestratorApiBaseUrl
+
PROCESSES_ENDPOINT
,
processesEndpoint
:
orchestratorApiBaseUrl
+
PROCESSES_ENDPOINT
,
environmentName
:
environmentName
:
getEnvValue
(
env
.
ENVIRONMENT_NAME
,
Environment
.
DEVELOPMENT
),
process
.
env
.
ENVIRONMENT_NAME
??
Environment
.
DEVELOPMENT
,
subscriptionActionsEndpoint
:
orchestratorApiBaseUrl
+
SUBSCRIPTION_ACTIONS_ENDPOINT
,
subscriptionActionsEndpoint
:
subscriptionProcessesEndpoint
:
orchestratorApiBaseUrl
+
SUBSCRIPTION_PROCESSES_ENDPOINT
,
orchestratorApiBaseUrl
+
SUBSCRIPTION_ACTIONS_ENDPOINT
,
orchestratorWebsocketUrl
:
getEnvValue
(
env
.
ORCHESTRATOR_WEBSOCKET_URL
,
DEFAULT_ORCHESTRATOR_WEBSOCKET_URL
),
subscriptionProcessesEndpoint
:
authActive
:
getBooleanEnvValue
(
env
.
AUTH_ACTIVE
,
true
),
orchestratorApiBaseUrl
+
SUBSCRIPTION_PROCESSES_ENDPOINT
,
useWebSockets
:
getBooleanEnvValue
(
env
.
USE_WEB_SOCKETS
,
false
),
orchestratorWebsocketUrl
:
useThemeToggle
:
getBooleanEnvValue
(
env
.
USE_THEME_TOGGLE
,
false
),
process
.
env
.
ORCHESTRATOR_WEBSOCKET_URL
||
workflowInformationLinkUrl
:
getEnvValue
(
env
.
WORKFLOW_INFORMATION_LINK_URL
,
DEFAULT_WORKFLOW_INFORMATION_LINK_URL
),
DEFAULT_ORCHESTRATOR_WEBSOCKET_URL
,
showWorkflowInformationLink
:
getBooleanEnvValue
(
env
.
SHOW_WORKFLOW_INFORMATION_LINK
,
false
),
authActive
:
process
.
env
.
AUTH_ACTIVE
?.
toLowerCase
()
!=
'
false
'
,
useWebSockets
:
process
.
env
.
USE_WEB_SOCKETS
?.
toLowerCase
()
===
'
true
'
,
useThemeToggle
:
process
.
env
.
USE_THEME_TOGGLE
?.
toLowerCase
()
===
'
true
'
,
workflowInformationLinkUrl
:
process
.
env
.
WORKFLOW_INFORMATION_LINK_URL
??
DEFAULT_WORKFLOW_INFORMATION_LINK_URL
,
showWorkflowInformationLink
:
process
.
env
.
SHOW_WORKFLOW_INFORMATION_LINK
?.
toLowerCase
()
===
'
true
'
,
};
};
};
};
Loading