mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2025-12-19 21:01:31 +00:00
Add python bootstrapper for containers
This commit is contained in:
30
data/Dockerfiles/bootstrap/main.py
Normal file
30
data/Dockerfiles/bootstrap/main.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
def main():
|
||||
container_name = os.getenv("CONTAINER_NAME")
|
||||
|
||||
if container_name == "sogo-mailcow":
|
||||
from modules.BootstrapSogo import Bootstrap
|
||||
else:
|
||||
print(f"No bootstrap handler for container: {container_name}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
b = Bootstrap(
|
||||
container=container_name,
|
||||
db_config = {
|
||||
"host": "localhost",
|
||||
"user": os.getenv("DBUSER"),
|
||||
"password": os.getenv("DBPASS"),
|
||||
"database": os.getenv("DBNAME"),
|
||||
"unix_socket": "/var/run/mysqld/mysqld.sock",
|
||||
'connection_timeout': 2
|
||||
},
|
||||
db_table="service_settings",
|
||||
db_settings=['sogo']
|
||||
)
|
||||
|
||||
b.bootstrap()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user