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
Commits
f245fd91
Commit
f245fd91
authored
1 year ago
by
Mohammad Torkashvand
Browse files
Options
Downloads
Patches
Plain Diff
make configration better and more readable
parent
2c7592ac
No related branches found
No related tags found
1 merge request
!20
New GUI V2 structure
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
configuration/configuration.ts
+43
-37
43 additions, 37 deletions
configuration/configuration.ts
with
43 additions
and
37 deletions
configuration/configuration.ts
+
43
−
37
View file @
f245fd91
import
process
from
'
process
'
;
import
{
Environment
,
OrchestratorConfig
}
from
'
@orchestrator-ui/orchestrator-ui-components
'
;
import
{
Environment
,
OrchestratorConfig
,
}
from
'
@orchestrator-ui/orchestrator-ui-components
'
;
export
const
DEFAULT_GRAPHQL_CORE_ENDPOINT
=
'
http://localhost:8080/api/graphql
'
;
// Default configurations
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_WEBSOCKET_URL
=
'
ws://localhost:8080
'
;
export
const
ENGINE_STATUS_ENDPOINT
=
'
/settings/status
'
;
export
const
PROCESSES_ENDPOINT
=
'
/processes
'
;
export
const
SUBSCRIPTION_ACTIONS_ENDPOINT
=
'
/subscriptions/workflows
'
;
export
const
SUBSCRIPTION_PROCESSES_ENDPOINT
=
'
/processes/process-subscriptions-by-subscription-id
'
;
export
const
SUBSCRIPTION_PROCESSES_ENDPOINT
=
'
/processes/process-subscriptions-by-subscription-id
'
;
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
=>
{
const
orchestratorGraphqlBaseUrl
=
process
.
env
.
ORCHESTRATOR_GRAPHQL_HOST
&&
process
.
env
.
ORCHESTRATOR_GRAPHQL_PATH
?
`
${
process
.
env
.
ORCHESTRATOR_GRAPHQL_HOST
}${
process
.
env
.
ORCHESTRATOR_GRAPHQL_PATH
}
`
:
DEFAULT_GRAPHQL_CORE_ENDPOINT
;
const
env
=
process
.
env
as
unknown
as
EnvConfig
;
// Construct URLs based on environment or defaults
const
orchestratorGraphqlBaseUrl
=
env
.
ORCHESTRATOR_GRAPHQL_HOST
&&
env
.
ORCHESTRATOR_GRAPHQL_PATH
?
`
${
env
.
ORCHESTRATOR_GRAPHQL_HOST
}${
env
.
ORCHESTRATOR_GRAPHQL_PATH
}
`
:
DEFAULT_GRAPHQL_CORE_ENDPOINT
;
const
orchestratorApiBaseUrl
=
process
.
env
.
ORCHESTRATOR_API_HOST
&&
process
.
env
.
ORCHESTRATOR_API_PATH
?
`
${
process
.
env
.
ORCHESTRATOR_API_HOST
}${
process
.
env
.
ORCHESTRATOR_API_PATH
}
`
:
DEFAULT_ORCHESTRATOR_API_BASE_URL
;
const
orchestratorApiBaseUrl
=
env
.
ORCHESTRATOR_API_HOST
&&
env
.
ORCHESTRATOR_API_PATH
?
`
${
env
.
ORCHESTRATOR_API_HOST
}${
env
.
ORCHESTRATOR_API_PATH
}
`
:
DEFAULT_ORCHESTRATOR_API_BASE_URL
;
return
{
orchestratorApiBaseUrl
,
engineStatusEndpoint
:
orchestratorApiBaseUrl
+
ENGINE_STATUS_ENDPOINT
,
graphqlEndpointCore
:
orchestratorGraphqlBaseUrl
,
processesEndpoint
:
orchestratorApiBaseUrl
+
PROCESSES_ENDPOINT
,
environmentName
:
process
.
env
.
ENVIRONMENT_NAME
??
Environment
.
DEVELOPMENT
,
subscriptionActionsEndpoint
:
orchestratorApiBaseUrl
+
SUBSCRIPTION_ACTIONS_ENDPOINT
,
subscriptionProcessesEndpoint
:
orchestratorApiBaseUrl
+
SUBSCRIPTION_PROCESSES_ENDPOINT
,
orchestratorWebsocketUrl
:
process
.
env
.
ORCHESTRATOR_WEBSOCKET_URL
||
DEFAULT_ORCHESTRATOR_WEBSOCKET_URL
,
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
'
,
environmentName
:
getEnvValue
(
env
.
ENVIRONMENT_NAME
,
Environment
.
DEVELOPMENT
),
subscriptionActionsEndpoint
:
orchestratorApiBaseUrl
+
SUBSCRIPTION_ACTIONS_ENDPOINT
,
subscriptionProcessesEndpoint
:
orchestratorApiBaseUrl
+
SUBSCRIPTION_PROCESSES_ENDPOINT
,
orchestratorWebsocketUrl
:
getEnvValue
(
env
.
ORCHESTRATOR_WEBSOCKET_URL
,
DEFAULT_ORCHESTRATOR_WEBSOCKET_URL
),
authActive
:
getBooleanEnvValue
(
env
.
AUTH_ACTIVE
,
true
),
useWebSockets
:
getBooleanEnvValue
(
env
.
USE_WEB_SOCKETS
,
false
),
useThemeToggle
:
getBooleanEnvValue
(
env
.
USE_THEME_TOGGLE
,
false
),
workflowInformationLinkUrl
:
getEnvValue
(
env
.
WORKFLOW_INFORMATION_LINK_URL
,
DEFAULT_WORKFLOW_INFORMATION_LINK_URL
),
showWorkflowInformationLink
:
getBooleanEnvValue
(
env
.
SHOW_WORKFLOW_INFORMATION_LINK
,
false
),
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment