Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Textgrid Repository WebDAV Server
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
DARIAH-DE
TextGridRep
Textgrid Repository WebDAV Server
Commits
4cebb95a
Verified
Commit
4cebb95a
authored
3 years ago
by
Stefan Hynek
Browse files
Options
Downloads
Patches
Plain Diff
feat(config): add AppConfig with property "dsn" for sentry initialization
parent
6cb7793b
No related branches found
No related tags found
1 merge request
!2
Resolve "track errors with sentry"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/repdav/config.py
+27
-15
27 additions, 15 deletions
src/repdav/config.py
with
27 additions
and
15 deletions
src/repdav/config.py
+
27
−
15
View file @
4cebb95a
import
logging
import
os
from
.errors
import
EnvNotSetError
from
.errors
import
EnvNotSetError
_logger
=
logging
.
getLogger
(
__name__
)
# TODO: remove "tg_auth_wsdl", "tg_auth_address", "tg_nav_address"
def
lookup_env_name
(
internal_name
:
str
)
->
str
:
mapping
=
{
"
_auth_wsdl
"
:
"
tg_auth_wsdl
"
,
"
_auth_address
"
:
"
tg_auth_address
"
,
"
_nav_address
"
:
"
tg_nav_address
"
,
"
_host
"
:
"
tg_host
"
,
"
_auth_wsdl
"
:
"
tg_auth_wsdl
"
,
"
_auth_address
"
:
"
tg_auth_address
"
,
"
_dsn
"
:
"
sentry_dsn
"
,
"
_host
"
:
"
tg_host
"
,
"
_nav_address
"
:
"
tg_nav_address
"
,
}
return
mapping
[
internal_name
]
# TODO check for trailing "/", add if missing!
# TODO check URLs for validity
class
AppConfig
:
# TODO: configure the app according to the set environment (i.e. prod or dev)
def
__init__
(
self
)
->
None
:
self
.
_dsn
=
os
.
getenv
(
lookup_env_name
(
"
_dsn
"
))
@property
def
dsn
(
self
)
->
str
:
return
self
.
_dsn
class
TextgridConfig
:
def
__init__
(
self
):
def
__init__
(
self
)
->
None
:
self
.
_auth_wsdl
=
os
.
getenv
(
lookup_env_name
(
"
_auth_wsdl
"
))
self
.
_auth_address
=
os
.
getenv
(
lookup_env_name
(
"
_auth_address
"
))
self
.
_nav_address
=
os
.
getenv
(
lookup_env_name
(
"
_nav_address
"
))
self
.
_host
=
os
.
getenv
(
lookup_env_name
(
"
_host
"
))
self
.
_nav_address
=
os
.
getenv
(
lookup_env_name
(
"
_nav_address
"
))
self
.
_host
=
os
.
getenv
(
lookup_env_name
(
"
_host
"
))
@property
def
auth_wsdl
(
self
):
def
auth_wsdl
(
self
)
->
str
:
if
self
.
_auth_wsdl
:
_logger
.
debug
(
self
.
_auth_wsdl
)
return
self
.
_auth_wsdl
raise
EnvNotSetError
(
lookup_env_name
(
"
_auth_wsdl
"
))
@property
def
auth_address
(
self
):
def
auth_address
(
self
)
->
str
:
if
self
.
_auth_address
:
return
self
.
_auth_address
raise
EnvNotSetError
(
lookup_env_name
(
"
_auth_address
"
))
@property
def
nav_address
(
self
):
def
nav_address
(
self
)
->
str
:
if
self
.
_nav_address
:
return
self
.
_nav_address
raise
EnvNotSetError
(
lookup_env_name
(
"
_nav_address
"
))
@property
def
host
(
self
):
def
host
(
self
)
->
str
:
if
self
.
_host
:
return
self
.
_host
raise
EnvNotSetError
(
lookup_env_name
(
"
_host
"
))
This diff is collapsed.
Click to expand it.
Stefan Hynek
@hynek
mentioned in commit
eab3502a
·
3 years ago
mentioned in commit
eab3502a
mentioned in commit eab3502a1317d3865691e0d79c2f72e0ccd8e341
Toggle commit list
Stefan Hynek
@hynek
mentioned in commit
61644a05
·
3 years ago
mentioned in commit
61644a05
mentioned in commit 61644a0511ab3ae6a939d6d3d42107c87ed6072c
Toggle commit list
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