Skip to content

Commit

Permalink
add Postgresql task (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: Sylvain Daste <sylvain.daste@myitcrew.fr>
  • Loading branch information
Sda79 and Sylvain Daste authored Aug 19, 2024
1 parent 176cb44 commit 16ff5e0
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions sipssert/tasks/postgresql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python
##
## This file is part of the SIPssert Testing Framework project
## Copyright (C) 2023 OpenSIPS Solutions
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##

from sipssert.task import Task

class PostgresqlTask(Task):

postgresql_default_env = {"POSTGRES_PASSWORD":"postgres"}
default_image = "postgres"
default_daemon = True
default_mount_point = "/docker-entrypoint-initdb.d"

def get_task_env(self):

env_dict = {}

if "postgres_password" in self.config:
self.root_password = self.config["postgres_password"]

if self.root_password:
env_dict["POSTGRES_PASSWORD"] = self.root_password
else:
env_dict = self.postgresql_default_env

return env_dict

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

0 comments on commit 16ff5e0

Please sign in to comment.