DocScoDoc/tests/api/start_api_server.sh

25 lines
637 B
Bash
Raw Normal View History

#!/bin/bash
# Script recreating the TEST API database and starting the serveur
set -e
# Le répertoire de ce script:
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# récupère API_USER et API_PASSWORD
source "$SCRIPT_DIR"/.env
export FLASK_ENV=test_api
export FLASK_DEBUG=1
tools/create_database.sh --drop SCODOC_TEST_API
flask db upgrade
flask sco-db-init --erase
flask init-test-database
flask user-create "$API_USER" LecteurAPI @all
flask user-password --password "$API_PASSWORD" "$API_USER"
flask edit-role LecteurAPI -a ScoView
flask user-role "$API_USER" -a LecteurAPI
flask run --host 0.0.0.0