6 Commits
0.0.3 ... 0.0.9

3 changed files with 28 additions and 11 deletions

View File

@ -37,8 +37,6 @@ build:
docker push $IMAGE_NAME:${CI_COMMIT_TAG}; docker push $IMAGE_NAME:${CI_COMMIT_TAG};
fi fi
deploy: deploy:
stage: deploy stage: deploy
image: registry.hottis.de/dockerized/docker-bash:latest image: registry.hottis.de/dockerized/docker-bash:latest
@ -56,6 +54,7 @@ deploy:
- SERVICE_PORT=5000 - SERVICE_PORT=5000
- docker volume inspect $SERVICE_VOLUME || docker volume create $SERVICE_VOLUME - docker volume inspect $SERVICE_VOLUME || docker volume create $SERVICE_VOLUME
- docker stop $CONTAINER_NAME || echo "$CONTAINER_NAME not running, anyway okay" - docker stop $CONTAINER_NAME || echo "$CONTAINER_NAME not running, anyway okay"
- docker rm $CONTAINER_NAME || echo "$CONTAINER_NAME not exsting, anyway okay"
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY; - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
- docker pull $IMAGE_NAME:${CI_COMMIT_TAG} - docker pull $IMAGE_NAME:${CI_COMMIT_TAG}
- docker run -d --restart always --name "hv2-api" --network docker-server --ip 172.16.10.38 -v $SERVICE_VOLUME:/opt/app/config $IMAGE_NAME:${CI_COMMIT_TAG} - docker run -d --restart always --name "hv2-api" --network docker-server --ip 172.16.10.38 -v $SERVICE_VOLUME:/opt/app/config $IMAGE_NAME:${CI_COMMIT_TAG}

11
auth.py
View File

@ -19,9 +19,10 @@ def decodeToken(token):
logger.error("{}".format(e)) logger.error("{}".format(e))
raise werkzeug.exceptions.Unauthorized() raise werkzeug.exceptions.Unauthorized()
def testToken(user, token_info):
return ''' def testToken(user, token_info):
You are user_id {user} and the provided token has been signed by this issuers. Fine.'. return {
Decoded token claims: {token_info}. "message": f"You are user_id {user} and the provided token has been signed by this issuers. Fine.",
'''.format(user=user, token_info=token_info) "details": token_info
}

View File

@ -1,10 +1,18 @@
openapi: 3.0.0 openapi: 3.0.0
info: info:
title: hv2-api title: hv2-api
version: "0.1" version: "1"
description: "REST-API for the Nober Grundbesitz GbR Hausverwaltungs-Software"
termsOfService: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:termsofuse"
contact:
name: "Wolfgang Hottgenroth"
email: "wolfgang.hottgenroth@icloud.com"
externalDocs:
description: "Find more details here"
url: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:externaldocs"
paths: paths:
/test: /v1/test:
get: get:
tags: [ "Test" ] tags: [ "Test" ]
summary: Return secret string summary: Return secret string
@ -13,9 +21,9 @@ paths:
'200': '200':
description: secret response description: secret response
content: content:
'text/plain': 'application/json':
schema: schema:
type: string $ref: '#/components/schemas/TestOutput'
security: security:
- jwt: ['secret'] - jwt: ['secret']
@ -27,3 +35,12 @@ components:
scheme: bearer scheme: bearer
bearerFormat: JWT bearerFormat: JWT
x-bearerInfoFunc: auth.decodeToken x-bearerInfoFunc: auth.decodeToken
schemas:
TestOutput:
description: Test Output
type: object
properties:
message:
type: string
details:
type: object