Skip to content

Commit

Permalink
Merge pull request #435 from afuetterer/429-application-factory
Browse files Browse the repository at this point in the history
fix: rename application factory
  • Loading branch information
huberrob authored Oct 13, 2023
2 parents 82da95e + 086002c commit ef2147f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions fuji_server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from flask_limiter.util import get_remote_address
from waitress import serve

from fuji_server.app.fuji_app import create_fuji_app
from fuji_server.app.fuji_app import create_app
from fuji_server.helper.preprocessor import Preprocessor


Expand Down Expand Up @@ -74,7 +74,7 @@ def main():
logger.info(f"Total LD vocabs imported : {len(preproc.getLinkedVocabs())}")
logger.info(f"Total default namespaces specified : {len(preproc.getDefaultNamespaces())}")

app = create_fuji_app(config)
app = create_app(config)
Limiter(get_remote_address, app=app.app, default_limits=[str(config["SERVICE"]["rate_limit"])])
# comment in case waitress is wished
# app.run(host=config['SERVICE']['service_host'], port=int(config['SERVICE']['service_port']),debug=False)
Expand Down
6 changes: 3 additions & 3 deletions fuji_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
from fuji_server import encoder


def create_fuji_app(config):
def create_app(config):
"""
Function which initializes the FUJI connexion flask app and returns it
"""
# you can also use Tornado or gevent as the HTTP server, to do so set server to tornado or gevent
ROOT_DIR = Path(__file__).parent.parent
ROOT_DIR = Path(__file__).parent
YAML_DIR = config["SERVICE"]["yaml_directory"]

app = connexion.FlaskApp(__name__, specification_dir=YAML_DIR)
API_YAML = os.path.join(ROOT_DIR, YAML_DIR, config["SERVICE"]["openapi_yaml"])
API_YAML = ROOT_DIR.joinpath(YAML_DIR, config["SERVICE"]["openapi_yaml"])
app.app.json_encoder = encoder.JSONEncoder

app.add_api(API_YAML, validate_responses=True)
Expand Down

0 comments on commit ef2147f

Please sign in to comment.