Commit bc40e375 authored by Stavros-Anastasios Charismiadis's avatar Stavros-Anastasios Charismiadis
Browse files

Merge branch 'minor_improvement' into 'main'

Minor improvement

See merge request !1
parents adee7912 0104bca0
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -15,11 +15,11 @@ GET /hello

## Getting started
To deploy the service, run the following command in an Ubuntu or MacOS terminal.

```
    cd dummy-aef
    chmod +x start_dummy_api.sh
    ./start_dummy_api.sh <Username provided by organizers>
```

The above command will deploy a docker container with the name or username inserted

The API of this AEF, during the tutorial, has to be accessible via the [CAPIF Provider Gateway](https://labs.etsi.org/rep/ocf/provider-gateway)
@@ -29,3 +29,15 @@ The neccesary files to configure the Provider Gateway with the AEF API are:

First fill the fields starting with <> with the correct information and then copy them to the Provider Gateway folder.


To check the logs, run the following command.
```
 ./logs_dummy_api.sh <Username provided by organizers>
```

To stop the service, run the following command.
```
 ./stops_dummy_api.sh <Username provided by organizers>
```

+0 −0

File moved.

+11 −2
Original line number Diff line number Diff line
import os
from flask import Flask, jsonify
from flask import Flask, jsonify, request
import logging

app = Flask(__name__)

@@ -7,11 +8,19 @@ app = Flask(__name__)
# Default to 'World' if the variable isn't set
app_name = os.getenv("APP_NAME", "World")

# Set up logging
app.logger.setLevel(logging.INFO)


@app.route("/hello", methods=["GET"])
def hello():
    # return f"Hello {app_name}"
    # Flask attempts to parse the token automatically
    token = request.authorization.token if request.authorization else None
    app.logger.info(f"JWT detected: {token}")
    return jsonify(f"Hello, {app_name}!")


if __name__ == "__main__":
    port = int(os.getenv("PORT", 8000))
    app.run(host='0.0.0.0', port=port)
+0 −0

File moved.

docker-compose.yml

0 → 100644
+11 −0
Original line number Diff line number Diff line
name: dummy
services:
  aef:
    image: flask-hello-service
    build:
      context: ./app  
    restart: unless-stopped
    ports:
      - 8000:8000
    environment:
      - APP_NAME=${APP_NAME}
Loading