This is the login service for Skyline CRS. It provides JWT based authentication for the system.
134
The login service is responsible for authenticating the client to access protected resources in the system, such as booking information.
This is a Docker based Python project, therefore it should be run in a container.
To run this service locally, along with its dependencies, Docker Compose may be used.
Navigate to the root Skyline CRS directory and run:
docker-compose up -d --build
This will run the entire Skyline CRS system locally using Docker Compose. You may modify docker-compose.yml to your liking, along with its respective .env file.
To build the image directly, navigate to the project's directory and run:
docker build -t skyline-login .
And to run the image in a new container run:
docker run -dp 80:80 \
-e SKYLINE_PNR_DB_URL=<PNR database URL> \
-e SKYLINE_ACCESS_TOKEN_SECRET=<Access token secret> \
skyline-flights
Note that this service depends on the PNR database to retrieve data. It is still usable to a degree by providing some URL to the SKYLINE_PNR_DB_URL and the SKYLINE_ACCESS_TOKEN_SECRET environment variables, which will allow access to the /docs and /redoc endpoints, but all other requests will result in an error from the service.
The service's API is documented at the Skyline CRS documentation.
If the service is up and running, there are also two interactive API documentation UIs available for the service:
/docs./redoc.The service is configured using environment variables. Note that some environment variables are required, and the image will not run without them.
SKYLINE_ACCESS_TOKEN_SECRET (Required)The secret to use for signing the generated JWT access tokens.
SKYLINE_PNR_DB_URL (Required)The PNR database URL for validating login data.
Example values:
mongodb://username:password@localhost:27017mongodb://username:password@pnr:27017SKYLINE_PNR_DB_NAMEThe name of the PNR database for the given database URL.
Default: pnr.
SKYLINE_PNR_DB_COLLECTION_NAMEThe name of the PNR database's PNR collection for the given database URL.
Default: pnrs.
SKYLINE_PORTThe TCP port for the service to listen on for incoming requests.
Default: 80.
SKYLINE_LOG_LEVELSets the log level for the service. Available values are: DEBUG, INFO, WARNING, ERROR, CRITICAL.
Default: INFO.
This project is based on the Python framework FastAPI and uses the Python package manager Poetry. Since the project is Docker based, it is not required to install Python and Poetry on the system, but it is highly recommended for local development.
3.10 and up.1.1 and up.To create a virtual environment with poetry and install all dependencies, navigate to the project's directory and run:
poetry install --no-root
This will create a new virtual environment and install all dependencies to it, except the project itself (hence the --no-root option).
To activate the virtual environment for the current shell run:
poetry shell
or use poetry run to execute commands inside the virtual environments without activating it. Check the Poetry documentation for more information.
In order to run the project locally, make sure to first set all required environment variables for the current shell session. The project uses the ASGI server Uvicorn for running the application.
To start the Uvicorn server locally, make sure you are at the projects directory and run:
uvicorn flights.main:app --port 80 --log-config logging.yaml --no-access-log
This will start the server on localhost:80 and will set up the logging for the application using the logging.yaml file.
The project uses multiple tools to assure code quality and correctness. Most of the tools are configured in the project's pyproject.toml file, except those who do not support this kind of configuration yet, and have their own configuration files, e.g. Flake8 with the configuration file .flake8. It is required to use these tools to ensure code quality before any commit!
black .isort .flake8mypy .pytestcoverage run -m pytest && coverage reportContent type
Image
Digest
Size
67.3 MB
Last updated
over 4 years ago
docker pull idos2002/skyline-login:0.2.0