EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Data Handling
core
Commits
2eb8117d
Commit
2eb8117d
authored
3 years ago
by
Fabian Schindler
Browse files
Options
Downloads
Patches
Plain Diff
Fixing typing issues in config parser
parent
aa024334
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Adding path registration capabilities
Pipeline
#19132
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
registrar/config.py
+14
-13
14 additions, 13 deletions
registrar/config.py
with
14 additions
and
13 deletions
registrar/config.py
+
14
−
13
View file @
2eb8117d
...
...
@@ -16,7 +16,7 @@ import yaml
ENV_PATTERN
=
re
.
compile
(
r
"
.*?\${(\w+)}.*?
"
)
def
constructor_env_variables
(
loader
:
yaml
.
Loader
,
node
:
str
):
def
constructor_env_variables
(
loader
:
yaml
.
Loader
,
node
):
"""
Extracts the environment variable from the node
'
s value
Args:
...
...
@@ -28,18 +28,19 @@ def constructor_env_variables(loader: yaml.Loader, node: str):
variable
"""
value
=
loader
.
construct_scalar
(
node
)
match
=
ENV_PATTERN
.
findall
(
value
)
# to find all env variables in line
if
match
:
full_value
=
value
for
g
in
match
:
env_variable
=
os
.
environ
.
get
(
g
,
)
if
env_variable
is
not
None
:
full_value
=
full_value
.
replace
(
f
"
${{
{
g
}
}}
"
,
env_variable
)
else
:
return
None
return
full_value
if
isinstance
(
value
,
str
):
match
=
ENV_PATTERN
.
findall
(
value
)
# to find all env variables in line
if
match
:
full_value
=
value
for
g
in
match
:
env_variable
=
os
.
environ
.
get
(
g
,
)
if
env_variable
is
not
None
:
full_value
=
full_value
.
replace
(
f
"
${{
{
g
}
}}
"
,
env_variable
)
else
:
return
None
return
full_value
return
value
...
...
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