Skip to content

Commit

Permalink
Merge pull request #219 from SAP/develop
Browse files Browse the repository at this point in the history
Upgrade to v4.6.1
  • Loading branch information
marcorosa authored Nov 24, 2021
2 parents 337deb8 + 4ee7807 commit 5ae8c29
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def requirements():

setuptools.setup(
name='credentialdigger',
version='4.6.0',
version='4.6.1',
author='SAP SE',
maintainer='Marco Rosa, Slim Trabelsi',
maintainer_email='[email protected], [email protected]',
Expand Down
6 changes: 5 additions & 1 deletion ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM python:3.9-bullseye
FROM python:3.9-bullseye as builder

RUN pip install flask_jwt_extended Flask python-dotenv
RUN apt-get update && apt-get install -y libhyperscan5 libpq-dev gunicorn3
RUN apt-get install -y dos2unix

# Don't verify ssl for github enterprise
RUN git config --global http.sslverify false
Expand All @@ -18,5 +19,8 @@ ARG SSL_private_key

COPY . /credential-digger-ui
WORKDIR /credential-digger-ui/
# Fix possible line-terminators errors
RUN find . -type f -print0 | xargs -0 dos2unix

RUN chmod +x run.sh
CMD [ "./run.sh" ]
15 changes: 15 additions & 0 deletions ui/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from enum import Enum
from itertools import groupby

import psycopg2
import yaml
from dotenv import load_dotenv
from flask import Flask, jsonify, make_response, redirect, render_template,\
Expand Down Expand Up @@ -158,6 +159,20 @@ def root():
categories=list(cat))


@app.errorhandler(psycopg2.InterfaceError)
def handle_pg_exception(e):
""" Handle postgres connection lost exceptions. """
global c
app.logger.error(e)
app.logger.warning('Re-connect to postgres and restart app')
c = PgUiClient(dbname=os.getenv('POSTGRES_DB'),
dbuser=os.getenv('POSTGRES_USER'),
dbpassword=os.getenv('POSTGRES_PASSWORD'),
dbhost=os.getenv('DBHOST'),
dbport=os.getenv('DBPORT'))
return redirect(url_for('root'))


@app.route('/files', methods=['GET'])
def files():
""" Files view of a repo. """
Expand Down

0 comments on commit 5ae8c29

Please sign in to comment.