/service-control

OGD Access Controller

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

service-control

Branch Status
develop Build Status
master Build Status

Table of Content

Summary of the project

service-control provides and manages the verified permissions. TBC

Local development

Dependencies

Prerequisites on host for development and build:

  • python version 3.12
  • pipenv
  • docker and docker compose

Setup

Copy the .env.dist file to .env on your local machine:

cp .env.dist .env

Initialize the local python environment with pipenv:

pipenv sync -d

and start the local postgres container

docker compose up

Local Development

vs code Integration

There are some possibilities to debug this codebase from within visual studio code.

Debug from vs code

In order to debug the service from within vs code, you need to create a launch-configuration. Create a folder .vscode in the root folder if it doesn't exist and put a file launch.json with this content in it:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python Debugger: Attach",
      "type": "debugpy",
      "request": "attach",
      "justMyCode": false,
      "connect": {
        "host": "localhost",
        "port": 5678
      }
    }
  ]
}

Now you can start the server with make serve-debug. The bootup will wait with the execution until the debugger is attached, which can most easily done by hitting f5.

Attach debugger to the tests

The same process described above can be used to debug tests. Simply run make test-debug, they will then wait until the debugger is attached.

Run tests from within vs code

The unit tests can also be invoked inside vs code directly. To do this you need to have following settings locally to your workspace:

  "python.testing.pytestArgs": [
    "app"
  ],
  "python.testing.unittestEnabled": false,
  "python.testing.pytestEnabled": true,
  "python.testing.debugPort": 5678

They can either be in .vscode/settings.json or in your workspace settings. Now the tests can be run and debugged with the testing tab of vscode (beaker icon).