Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-socio-fiscal-ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
leximpact-socio-fiscal-ui
Commits
92871da5
Commit
92871da5
authored
2 months ago
by
David Smadja
Browse files
Options
Downloads
Patches
Plain Diff
Modify url templates placeholders in env file
parent
fe9797c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
example.env
+2
-2
2 additions, 2 deletions
example.env
src/lib/repositories.ts
+16
-27
16 additions, 27 deletions
src/lib/repositories.ts
with
18 additions
and
29 deletions
example.env
+
2
−
2
View file @
92871da5
...
...
@@ -75,8 +75,8 @@ PUBLIC_MATOMO_SUBDOMAINS="*.DOMAIN"
PUBLIC_OPENFISCA_BRANCH="master"
PUBLIC_OPENFISCA_GROUP="openfisca"
PUBLIC_OPENFISCA_PROJECT="openfisca-france"
PUBLIC_OPENFISCA_REPOSITORY_RAW_URL_TEMPLATE="https://raw.githubusercontent.com/$
{
group
}
/$
{
project
}
/$
{
branch
}
/$
{
path
}
"
PUBLIC_OPENFISCA_REPOSITORY_URL_TEMPLATE="https://github.com/$
{
group
}
/$
{
project
}
/blob/$
{
branch
}
/$
{
path
}
"
PUBLIC_OPENFISCA_REPOSITORY_RAW_URL_TEMPLATE="https://raw.githubusercontent.com/$
<
group
>
/$
<
project
>
/$
<
branch
>
/$
<
path
>
"
PUBLIC_OPENFISCA_REPOSITORY_URL_TEMPLATE="https://github.com/$
<
group
>
/$
<
project
>
/blob/$
<
branch
>
/$
<
path
>
"
# URL of portal site (used when clicking on left logo in menu bar)
PUBLIC_PORTAL_URL="https://leximpact.an.fr/"
...
...
This diff is collapsed.
Click to expand it.
src/lib/repositories.ts
+
16
−
27
View file @
92871da5
import
type
{
Parameter
}
from
"
@openfisca/json-model
"
export
interface
RepositoryConfig
{
branch
:
string
group
:
string
...
...
@@ -12,40 +11,30 @@ export function newParameterRepositoryRawUrl(
{
branch
,
group
,
project
,
rawUrlTemplate
}:
RepositoryConfig
,
parameter
:
Parameter
,
):
string
|
undefined
{
const
path
=
parameter
.
file_path
const
path
=
parameter
.
file_path
;
if
(
path
===
undefined
)
{
return
undefined
return
undefined
;
}
// Can't use:
// return eval("`" + rawUrlTemplate + "`")
// because using direct eval with a bundler is not recommended and may cause problems
// (more info: https://esbuild.github.io/link/direct-eval)
return
new
Function
(
"
branch
"
,
"
group
"
,
"
project
"
,
"
path
"
,
"
return `
"
+
rawUrlTemplate
+
"
`
"
,
)(
branch
,
group
,
project
,
path
)
const
url
=
rawUrlTemplate
.
replace
(
"
$<group>
"
,
group
)
.
replace
(
"
$<project>
"
,
project
)
.
replace
(
"
$<branch>
"
,
branch
)
.
replace
(
"
$<path>
"
,
path
);
return
url
;
}
export
function
newParameterRepositoryUrl
(
{
branch
,
group
,
project
,
urlTemplate
}:
RepositoryConfig
,
parameter
:
Parameter
,
):
string
|
undefined
{
const
path
=
parameter
.
file_path
const
path
=
parameter
.
file_path
;
if
(
path
===
undefined
)
{
return
undefined
return
undefined
;
}
// Can't use:
// return eval("`" + urlTemplate + "`")
// because using direct eval with a bundler is not recommended and may cause problems
// (more info: https://esbuild.github.io/link/direct-eval)
return
new
Function
(
"
branch
"
,
"
group
"
,
"
project
"
,
"
path
"
,
"
return `
"
+
urlTemplate
+
"
`
"
,
)(
branch
,
group
,
project
,
path
)
const
url
=
urlTemplate
.
replace
(
"
$<group>
"
,
group
)
.
replace
(
"
$<project>
"
,
project
)
.
replace
(
"
$<branch>
"
,
branch
)
.
replace
(
"
$<path>
"
,
path
);
return
url
;
}
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