Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
opennsa3
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
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
Michal Hažlinský
opennsa3
Commits
ec39a1d7
Commit
ec39a1d7
authored
3 years ago
by
Hans Trompert
Browse files
Options
Downloads
Patches
Plain Diff
always try to find key and certificate in config
parent
08bfac10
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opennsa/config.py
+20
-9
20 additions, 9 deletions
opennsa/config.py
with
20 additions
and
9 deletions
opennsa/config.py
+
20
−
9
View file @
ec39a1d7
...
@@ -315,6 +315,16 @@ class Config(object):
...
@@ -315,6 +315,16 @@ class Config(object):
except
configparser
.
NoOptionError
:
except
configparser
.
NoOptionError
:
vc
[
BASE_URL
]
=
None
vc
[
BASE_URL
]
=
None
try
:
vc
[
KEY
]
=
cfg
.
get
(
BLOCK_SERVICE
,
KEY
)
except
configparser
.
NoOptionError
:
vc
[
KEY
]
=
None
try
:
vc
[
CERTIFICATE
]
=
cfg
.
get
(
BLOCK_SERVICE
,
CERTIFICATE
)
except
configparser
.
NoOptionError
:
vc
[
CERTIFICATE
]
=
None
try
:
try
:
policies
=
cfg
.
get
(
BLOCK_SERVICE
,
POLICY
).
split
(
'
,
'
)
policies
=
cfg
.
get
(
BLOCK_SERVICE
,
POLICY
).
split
(
'
,
'
)
for
policy
in
policies
:
for
policy
in
policies
:
...
@@ -356,18 +366,19 @@ class Config(object):
...
@@ -356,18 +366,19 @@ class Config(object):
# tls
# tls
if
vc
[
TLS
]:
if
vc
[
TLS
]:
try
:
try
:
hostkey
=
cfg
.
get
(
BLOCK_SERVICE
,
KEY
)
if
not
vc
[
KEY
]:
hostcert
=
cfg
.
get
(
BLOCK_SERVICE
,
CERTIFICATE
)
if
not
os
.
path
.
exists
(
hostkey
):
raise
ConfigurationError
(
raise
ConfigurationError
(
'
Specified hostkey does not exist (%s)
'
%
hostkey
)
'
must specify a key when TLS is enabled
'
)
if
not
os
.
path
.
exists
(
hostcert
):
el
if
not
os
.
path
.
exists
(
vc
[
KEY
]
):
raise
ConfigurationError
(
raise
ConfigurationError
(
'
Specified
hostcert
does not exist (%s)
'
%
hostcert
)
'
Specified
key
does not exist (%s)
'
%
vc
[
KEY
]
)
vc
[
KEY
]
=
hostkey
if
not
vc
[
CERTIFICATE
]:
vc
[
CERTIFICATE
]
=
hostcert
raise
ConfigurationError
(
'
must specify a certificate when TLS is enabled
'
)
elif
not
os
.
path
.
exists
(
vc
[
CERTIFICATE
]):
raise
ConfigurationError
(
'
Specified certificate does not exist (%s)
'
%
vc
[
CERTIFICATE
])
try
:
try
:
allowed_hosts_cfg
=
cfg
.
get
(
BLOCK_SERVICE
,
ALLOWED_HOSTS
)
allowed_hosts_cfg
=
cfg
.
get
(
BLOCK_SERVICE
,
ALLOWED_HOSTS
)
...
...
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