Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pappac authored and pappac committed Aug 8, 2024
0 parents commit c013f1c
Show file tree
Hide file tree
Showing 28 changed files with 63 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.venv/
/.idea/
.dockerignore
.gitignore
Dockerfile
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.venv/
/.idea/
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:alpine
RUN apk update


ENV APP_HOST='0.0.0.0' \
APP_PORT='8080' \
APP_DEBUG_MODE=True



WORKDIR /app

COPY . .

RUN pip install -r requirements.txt

ENTRYPOINT ["python","-m", "server.app"]
Empty file added __init__.py
Empty file.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flask==3.0.3
Empty file added server/__init__.py
Empty file.
Binary file added server/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file added server/__pycache__/app.cpython-312.pyc
Binary file not shown.
Binary file added server/__pycache__/blueprint_manager.cpython-312.pyc
Binary file not shown.
Binary file added server/__pycache__/blueprints.cpython-312.pyc
Binary file not shown.
Binary file added server/__pycache__/config.cpython-312.pyc
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions server/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from flask import Flask
from server.config import Config
from server.register_blueprints import register_blueprints
app = Flask(__name__)
app.config.from_object(Config)

if __name__ == '__main__':
register_blueprints(app)
app.run(host=app.config.get('APP_HOST'), port=app.config.get('APP_PORT'), debug=app.config.get('APP_DEBUG_MODE'))
Empty file added server/blueprints/__init__.py
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added server/blueprints/__pycache__/index.cpython-312.pyc
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions server/blueprints/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from flask import Blueprint, jsonify
from ..services.health_service import get_basic_health

index = Blueprint('index', __name__)


@index.route("/")
def hello_world():
health = {"internal": get_basic_health(1)}
return jsonify(health)

@index.route("/level/<level>")
def byebye_world(level):
health = {"internal": get_basic_health(int(level))}
return jsonify(health)
6 changes: 6 additions & 0 deletions server/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os

class Config:
APP_HOST=os.environ['APP_HOST']
APP_PORT=os.environ['APP_PORT']
APP_DEBUG_MODE=os.environ['APP_DEBUG_MODE']
Empty file added server/dev_utils/__init__.py
Empty file.
Empty file added server/helpers/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions server/register_blueprints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .blueprints.index import index

def register_blueprints(app):
app.register_blueprint(index)
Empty file added server/services/__init__.py
Empty file.
Binary file added server/services/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions server/services/health_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def get_basic_health(level: int) -> dict:
if level == 1:
return {"status": "ok"}
return {"status": "ok", "services": "ok"}
Empty file added server/tests/__init__.py
Empty file.

0 comments on commit c013f1c

Please sign in to comment.