1 # Copyright (C) 2021 Wind River Systems, Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 def get_postgres_uri():
18 host = os.environ.get("DB_HOST", "localhost")
19 port = 54321 if host == "localhost" else 5432
20 password = os.environ.get("DB_PASSWORD", "o2ims123")
21 user, db_name = "o2ims", "o2ims"
22 return f"postgresql://{user}:{password}@{host}:{port}/{db_name}"
26 host = os.environ.get("API_HOST", "localhost")
27 port = 5005 if host == "localhost" else 80
28 return f"http://{host}:{port}"
30 def get_o2ims_api_base():
31 return '/o2ims_infrastructureInventory/v1'
33 def get_redis_host_and_port():
34 host = os.environ.get("REDIS_HOST", "localhost")
35 port = 63791 if host == "localhost" else 6379
36 return dict(host=host, port=port)
39 def get_smo_o2endpoint():
40 smo_o2endpoint = os.environ.get("SMO_O2_ENDPOINT", "http://localhost/smo_sim")