Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
athena
Manage
Activity
Members
Labels
Plan
Issues
38
Issue boards
Milestones
Wiki
Code
Merge requests
34
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
EIC
detectors
athena
Commits
854b17c4
Commit
854b17c4
authored
3 years ago
by
Wouter Deconinck
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Allow for FileLoader to parse environment variables as part of the cache path"
parent
01e51f9f
No related branches found
No related tags found
2 merge requests
!329
Master into deathvalley
,
!319
Resolve "Allow for FileLoader to parse environment variables as part of the cache path"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compact/tracking_config_deathvalley.xml
+1
-0
1 addition, 0 deletions
compact/tracking_config_deathvalley.xml
src/FileLoader.cpp
+19
-0
19 additions, 0 deletions
src/FileLoader.cpp
with
20 additions
and
0 deletions
compact/tracking_config_deathvalley.xml
+
1
−
0
View file @
854b17c4
...
@@ -100,6 +100,7 @@
...
@@ -100,6 +100,7 @@
</documentation>
</documentation>
<plugins>
<plugins>
<plugin
name=
"FileLoader"
>
<plugin
name=
"FileLoader"
>
<arg
value=
"cache:$DETECTOR_PATH"
/>
<arg
value=
"file:calibrations/materials-map.cbor"
/>
<arg
value=
"file:calibrations/materials-map.cbor"
/>
<arg
value=
"url:https://eicweb.phy.anl.gov/EIC/detectors/athena/uploads/4a4e7c8eb6089b634d762d112c89bd5d/material-maps.cbor"
/>
<arg
value=
"url:https://eicweb.phy.anl.gov/EIC/detectors/athena/uploads/4a4e7c8eb6089b634d762d112c89bd5d/material-maps.cbor"
/>
</plugin>
</plugin>
...
...
This diff is collapsed.
Click to expand it.
src/FileLoader.cpp
+
19
−
0
View file @
854b17c4
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include
<filesystem>
#include
<filesystem>
#include
<iostream>
#include
<iostream>
#include
<cstdlib>
#include
<string>
#include
<string>
namespace
fs
=
std
::
filesystem
;
namespace
fs
=
std
::
filesystem
;
...
@@ -57,6 +58,24 @@ long load_file(
...
@@ -57,6 +58,24 @@ long load_file(
return
0
;
return
0
;
}
}
// parse cache for environment variables
auto
pos
=
std
::
string
::
npos
;
while
((
pos
=
cache
.
find
(
'$'
))
!=
std
::
string
::
npos
)
{
auto
after
=
cache
.
find_first_not_of
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"_"
,
pos
+
1
);
if
(
after
==
std
::
string
::
npos
)
after
=
cache
.
size
();
// cache ends on env var
auto
env_name
=
cache
.
substr
(
pos
+
1
,
after
-
pos
-
1
);
auto
env_value
=
std
::
getenv
(
env_name
.
c_str
());
if
(
env_value
==
nullptr
)
env_value
=
""
;
cache
.
erase
(
pos
,
after
-
pos
);
cache
.
insert
(
pos
,
env_value
);
printout
(
INFO
,
"FileLoader"
,
"$"
+
env_name
+
" -> "
+
env_value
);
}
// create file path
// create file path
fs
::
path
file_path
(
file
);
fs
::
path
file_path
(
file
);
...
...
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