Skip to content

Commit

Permalink
Always trust DB connections
Browse files Browse the repository at this point in the history
Postgres DB operates on a private network, we can allow connections from
all sources without auth. Data is also non-sensitive.

Avoid division by zero error when building charts right after startup.
  • Loading branch information
bobf committed Apr 5, 2021
1 parent c9608dd commit 37edb2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/charts/charts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def calculate_period(self):
if not data:
return None

return max(x['tstamp'] for x in data) - min(x['tstamp'] for x in data)
return min(1, max(x['tstamp'] for x in data) - min(x['tstamp'] for x in data))

def build(self, sid):
try:
Expand Down
2 changes: 1 addition & 1 deletion charts/charts/charts/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Container(Base):
@classmethod
def get_id(class_, data):
return data.get('containerID', None)
return data.get('containerID', None)

def __init__(self, db_connection, data, publisher, logger):
self.id = Container.get_id(data)
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ services:
replicas: 1
environment:
PGDATA: /var/lib/postgres/data
POSTGRES_HOST_AUTH_METHOD: trust
# To persist database storage, use a configuration similar to this:
# volumes:
# - "/shared/network/storage/skep/:/var/lib/postgres/data/:rw"
Expand Down

0 comments on commit 37edb2b

Please sign in to comment.