Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
production
building-knowledge-centre
building-dao
Commits
a05337dd
Commit
a05337dd
authored
Sep 24, 2019
by
Marc-Andre Santune
Browse files
retrieve staging and registry from kwargs
parent
1cd590f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
building_dao/building_generic.py
building_dao/building_generic.py
+7
-2
building_dao/settings.py
building_dao/settings.py
+6
-3
No files found.
building_dao/building_generic.py
View file @
a05337dd
...
...
@@ -21,10 +21,15 @@ class BuildingGeneric:
"""Stores the methods used to receive or update the building info from ES doc"""
def
__init__
(
self
,
uid
:
str
,
staging
:
str
)
->
None
:
def
__init__
(
self
,
uid
:
str
,
**
kwargs
)
->
None
:
staging
=
kwargs
.
get
(
"staging"
,
False
)
registry
=
kwargs
.
get
(
"registry"
)
self
.
logger
=
logging
.
getLogger
(
self
.
__class__
.
__name__
)
self
.
_uid
=
uid
self
.
settings
=
Settings
(
staging
=
staging
)
self
.
settings
=
Settings
(
staging
=
staging
,
registry
=
registry
)
self
.
fetch
()
def
__getitem__
(
self
,
item
):
...
...
building_dao/settings.py
View file @
a05337dd
"""Store settings"""
from
MaxIcsRegistry
import
MaxIcsRegistry
class
Settings
:
def
__init__
(
self
,
staging
:
str
,
registry
=
None
):
"""Settings"""
def
__init__
(
self
,
staging
:
bool
=
False
,
registry
=
None
)
->
None
:
if
not
registry
:
registry
=
MaxIcsRegistry
.
from_env
(
staging
=
staging
,
skip_delay
=
True
)
registry
=
MaxIcsRegistry
.
from_env
(
staging
=
staging
)
building_center_info
=
registry
.
get_info
(
"building-knowledge-information-center"
)
self
.
api_key
=
building_center_info
[
"api_in"
][
registry
.
node_id
][
"key"
]
self
.
base_url
=
"http://{}:{}/api/buildings/"
.
format
(
building_center_info
[
"service_addr"
],
building_center_info
[
"service_port"
]
)
\ No newline at end of file
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment