Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoBackendAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Dojo Project (HES-SO)
Projects
Backend
DojoBackendAPI
Commits
3ad24d2d
Commit
3ad24d2d
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
Config => Add exercice resultsFolder and default values on all vars
parent
93802f99
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ExpressAPI/src/config/Config.ts
+29
-27
29 additions, 27 deletions
ExpressAPI/src/config/Config.ts
with
29 additions
and
27 deletions
ExpressAPI/src/config/Config.ts
+
29
−
27
View file @
3ad24d2d
import
GitlabVisibility
from
'
../shared/types/Gitlab/GitlabVisibility
'
;
class
Config
{
public
readonly
api
:
{
port
:
number
...
...
@@ -20,7 +23,7 @@ class Config {
};
public
exercice
:
{
maxSameName
:
number
;
default
:
{
description
:
string
;
visibility
:
string
;
};
maxSameName
:
number
;
resultsFolder
:
string
;
default
:
{
description
:
string
;
visibility
:
string
;
};
};
public
readonly
userPasswordLength
:
number
;
...
...
@@ -28,59 +31,58 @@ class Config {
constructor
()
{
this
.
api
=
{
port
:
Number
(
process
.
env
.
API_PORT
)
port
:
Number
(
process
.
env
.
API_PORT
||
30992
)
};
this
.
jwtConfig
=
{
secret
:
process
.
env
.
JWT_SECRET_KEY
,
expiresIn
:
Number
(
process
.
env
.
SESSION_TIMEOUT
)
secret
:
process
.
env
.
JWT_SECRET_KEY
||
''
,
expiresIn
:
Number
(
process
.
env
.
SESSION_TIMEOUT
||
0
)
};
this
.
permissions
=
{
teachingStaff
:
JSON
.
parse
(
process
.
env
.
ROLES_WITH_TEACHING_STAFF_PERMISSIONS
)
teachingStaff
:
JSON
.
parse
(
process
.
env
.
ROLES_WITH_TEACHING_STAFF_PERMISSIONS
||
'
[]
'
)
};
this
.
gitlab
=
{
apiURL
:
process
.
env
.
GITLAB_API_URL
,
apiURL
:
process
.
env
.
GITLAB_API_URL
||
''
,
urls
:
JSON
.
parse
(
process
.
env
.
GITLAB_URLS
||
'
[]
'
),
account
:
{
id
:
Number
(
process
.
env
.
GITLAB_DOJO_ACCOUNT_ID
),
username
:
process
.
env
.
GITLAB_DOJO_ACCOUNT_USERNAME
,
token
:
process
.
env
.
GITLAB_DOJO_ACCOUNT_TOKEN
id
:
Number
(
process
.
env
.
GITLAB_DOJO_ACCOUNT_ID
||
0
),
username
:
process
.
env
.
GITLAB_DOJO_ACCOUNT_USERNAME
||
''
,
token
:
process
.
env
.
GITLAB_DOJO_ACCOUNT_TOKEN
||
''
},
group
:
{
root
:
Number
(
process
.
env
.
GITLAB_GROUP_ROOT_ID
),
templates
:
Number
(
process
.
env
.
GITLAB_GROUP_TEMPLATES_ID
),
enonces
:
Number
(
process
.
env
.
GITLAB_GROUP_ENONCES_ID
),
exercices
:
Number
(
process
.
env
.
GITLAB_GROUP_EXERCICES_ID
)
root
:
Number
(
process
.
env
.
GITLAB_GROUP_ROOT_ID
||
0
),
templates
:
Number
(
process
.
env
.
GITLAB_GROUP_TEMPLATES_ID
||
0
),
enonces
:
Number
(
process
.
env
.
GITLAB_GROUP_ENONCES_ID
||
0
),
exercices
:
Number
(
process
.
env
.
GITLAB_GROUP_EXERCICES_ID
||
0
)
}
};
this
.
enonce
=
{
default
:
{
description
:
process
.
env
.
ENONCE_DEFAULT_DESCRIPTION
,
initReadme
:
process
.
env
.
ENONCE_DEFAULT_INIT_README
.
toBoolean
(),
sharedRunnersEnabled
:
process
.
env
.
ENONCE_DEFAULT_SHARED_RUNNERS_ENABLED
.
toBoolean
(),
visibility
:
process
.
env
.
ENONCE_DEFAULT_VISIBILITY
,
wikiEnabled
:
process
.
env
.
ENONCE_DEFAULT_WIKI_ENABLED
.
toBoolean
(),
template
:
process
.
env
.
ENONCE_DEFAULT_TEMPLATE
.
replace
(
'
{{USERNAME}}
'
,
this
.
gitlab
.
account
.
username
).
replace
(
'
{{TOKEN}}
'
,
this
.
gitlab
.
account
.
token
)
description
:
process
.
env
.
ENONCE_DEFAULT_DESCRIPTION
?.
convertWithEnvVars
()
??
''
,
initReadme
:
process
.
env
.
ENONCE_DEFAULT_INIT_README
?
.
toBoolean
()
??
false
,
sharedRunnersEnabled
:
process
.
env
.
ENONCE_DEFAULT_SHARED_RUNNERS_ENABLED
?
.
toBoolean
()
??
true
,
visibility
:
process
.
env
.
ENONCE_DEFAULT_VISIBILITY
||
GitlabVisibility
.
PRIVATE
,
wikiEnabled
:
process
.
env
.
ENONCE_DEFAULT_WIKI_ENABLED
?
.
toBoolean
()
??
false
,
template
:
process
.
env
.
ENONCE_DEFAULT_TEMPLATE
?
.
replace
(
'
{{USERNAME}}
'
,
this
.
gitlab
.
account
.
username
).
replace
(
'
{{TOKEN}}
'
,
this
.
gitlab
.
account
.
token
)
??
''
},
baseFiles
:
JSON
.
parse
(
process
.
env
.
ENONCE_BASE_FILES
||
'
[]
'
),
filename
:
process
.
env
.
ENONCE_FILENAME
||
''
};
this
.
exercice
=
{
maxSameName
:
Number
(
process
.
env
.
EXERCICE_MAX_SAME_NAME
),
maxSameName
:
Number
(
process
.
env
.
EXERCICE_MAX_SAME_NAME
||
0
),
resultsFolder
:
process
.
env
.
EXERCICE_RESULTS_FOLDER
??
''
,
//Do not use convertWithEnvVars() because it is used in the exercice creation and muste be interpreted at exercice runtime
default
:
{
description
:
process
.
env
.
EXERCICE_DEFAULT_DESCRIPTION
,
visibility
:
process
.
env
.
EXERCICE_DEFAULT_VISIBILITY
description
:
process
.
env
.
EXERCICE_DEFAULT_DESCRIPTION
?.
convertWithEnvVars
()
??
''
,
visibility
:
process
.
env
.
EXERCICE_DEFAULT_VISIBILITY
||
GitlabVisibility
.
PRIVATE
}
};
this
.
userPasswordLength
=
Number
(
process
.
env
.
USER_PASSWORD_LENGTH
);
this
.
userPasswordSaltRounds
=
Number
(
process
.
env
.
USER_PASSWORD_SALT_ROUNDS
);
this
.
userPasswordLength
=
Number
(
process
.
env
.
USER_PASSWORD_LENGTH
||
0
);
this
.
userPasswordSaltRounds
=
Number
(
process
.
env
.
USER_PASSWORD_SALT_ROUNDS
||
10
);
}
}
...
...
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