Loading src/nbi/Config.py +7 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ # limitations under the License. from werkzeug.security import generate_password_hash from common.Constants import ServiceNameEnum from common.Settings import get_service_host, get_setting # REST-API users RESTAPI_USERS = { # TODO: implement a database of credentials and permissions Loading @@ -21,3 +23,8 @@ RESTAPI_USERS = { # TODO: implement a database of credentials and permissions # Rebuild using: "python -c 'import secrets; print(secrets.token_hex())'" SECRET_KEY = '2b8ab76763d81f7bced786de8ba40bd67eea6ff79217a711eb5f8d1f19c145c1' redis_host = get_service_host(ServiceNameEnum.NBI) redis_port = 6379 redis_pass = get_setting('REDIS_PASSWORD') REDIS_URL = 'redis://:{:s}@{:s}:{:d}'.format(redis_pass, redis_host, redis_port) src/nbi/requirements.in +4 −2 Original line number Diff line number Diff line Loading @@ -12,16 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. asgiref==3.9.* deepdiff==6.7.* deepmerge==1.1.* eventlet==0.39.0 Flask==2.1.3 Flask[async]==2.1.3 Flask-HTTPAuth==4.5.0 Flask-RESTful==0.3.9 flask-socketio==5.5.1 flask-sse==1.0.0 #gevent==24.11.1 #gevent-websocket==0.10.1 #greenlet==3.1.1 greenlet==3.1.* gunicorn==23.0.0 jsonschema==4.4.0 kafka-python==2.0.6 Loading src/nbi/service/NbiApplication.py +4 −1 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ from typing import Any, List, Optional, Tuple from flask import Flask, request from flask_restful import Api, Resource from flask_socketio import Namespace, SocketIO from flask_sse import sse from common.tools.kafka.Variables import KafkaConfig, KafkaTopic from nbi.Config import SECRET_KEY from nbi.Config import REDIS_URL, SECRET_KEY from nbi.service.database.base import rebuild_database from .database.Engine import Engine Loading @@ -41,6 +42,8 @@ class NbiApplication: self._app = Flask(__name__) self._app.config['SECRET_KEY'] = SECRET_KEY self._app.config['REDIS_URL'] = REDIS_URL self._app.register_blueprint(sse, url_prefix='/restconf/stream') self._app.after_request(log_request) self._api = Api(self._app, prefix=base_url) Loading Loading
src/nbi/Config.py +7 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ # limitations under the License. from werkzeug.security import generate_password_hash from common.Constants import ServiceNameEnum from common.Settings import get_service_host, get_setting # REST-API users RESTAPI_USERS = { # TODO: implement a database of credentials and permissions Loading @@ -21,3 +23,8 @@ RESTAPI_USERS = { # TODO: implement a database of credentials and permissions # Rebuild using: "python -c 'import secrets; print(secrets.token_hex())'" SECRET_KEY = '2b8ab76763d81f7bced786de8ba40bd67eea6ff79217a711eb5f8d1f19c145c1' redis_host = get_service_host(ServiceNameEnum.NBI) redis_port = 6379 redis_pass = get_setting('REDIS_PASSWORD') REDIS_URL = 'redis://:{:s}@{:s}:{:d}'.format(redis_pass, redis_host, redis_port)
src/nbi/requirements.in +4 −2 Original line number Diff line number Diff line Loading @@ -12,16 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. asgiref==3.9.* deepdiff==6.7.* deepmerge==1.1.* eventlet==0.39.0 Flask==2.1.3 Flask[async]==2.1.3 Flask-HTTPAuth==4.5.0 Flask-RESTful==0.3.9 flask-socketio==5.5.1 flask-sse==1.0.0 #gevent==24.11.1 #gevent-websocket==0.10.1 #greenlet==3.1.1 greenlet==3.1.* gunicorn==23.0.0 jsonschema==4.4.0 kafka-python==2.0.6 Loading
src/nbi/service/NbiApplication.py +4 −1 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ from typing import Any, List, Optional, Tuple from flask import Flask, request from flask_restful import Api, Resource from flask_socketio import Namespace, SocketIO from flask_sse import sse from common.tools.kafka.Variables import KafkaConfig, KafkaTopic from nbi.Config import SECRET_KEY from nbi.Config import REDIS_URL, SECRET_KEY from nbi.service.database.base import rebuild_database from .database.Engine import Engine Loading @@ -41,6 +42,8 @@ class NbiApplication: self._app = Flask(__name__) self._app.config['SECRET_KEY'] = SECRET_KEY self._app.config['REDIS_URL'] = REDIS_URL self._app.register_blueprint(sse, url_prefix='/restconf/stream') self._app.after_request(log_request) self._api = Api(self._app, prefix=base_url) Loading