Skip to content
Snippets Groups Projects
README.md 1.45 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Huss's avatar
    David Huss committed
    
    
    David Huss's avatar
    David Huss committed
    ## Run dev-server with poetry
    
    To make a development server run on localhost:
    ```python3
    
    David Huss's avatar
    David Huss committed
    export FLASK_APP=stechuhr_server/server.py
    
    export FLASK_ENV=development
    
    David Huss's avatar
    David Huss committed
    poetry run flask run --cert=adhoc
    
    David Huss's avatar
    David Huss committed
    ## Run with python3-ven in production
    
    Make sure `python3-venv` is installed:
    
    ```bash
    sudo apt install python3-venv
    ```
    
    Then clone the repo and enter it:
    
    ```bash
    git clone ssh://git@code.hfbk.net:4242/pandemic_response/stechuhr-server.git
    cd stechuhr-server
    ```
    
    Create a new venv environment, activate it, install the reuqirements from requirements.txt and start the server
    ```
    python3 -m venv env
    source env/bin/activate
    pip3 install -r requirements.txt
    python3 stechuhr_server/server.py
    ```
    
    Check the output to find the config directory. You might want to run it as a different user tho.
    
    
    David Huss's avatar
    David Huss committed
    There is also a systemctl unit file that you probably need to change to your needs
    
    In production it makes sense to run stechuhr with gunicorn:
    
    ```bash
    source env/bin/activate
    gunicorn stechuhr_server.server:app
    ```
    
    David Huss's avatar
    David Huss committed
    
    # Configuration
    
    ## ID verification
    
    in `config.toml` you can add a list of regex patterns that stechuhr (*both on server and on client!*) uses to verify the Card IDs. These two patterns for example allow upper/lowercase hex strings with lengths either between 6 and 16 characters OR exactly 24 characters:
    
    ```toml
    id_patterns = [
        "^[A-Fa-f0-9]{24}$",
        "^[A-Fa-f0-9]{6,16}$",
    ]
    ```
    
    If in doubt consider [testing your regexes here](https://regexplained.com/)