diff --git a/main.star b/main.star index 2451996..c9f9372 100644 --- a/main.star +++ b/main.star @@ -1,5 +1,8 @@ +adminer_module = import_module("github.com/bharath-123/db-adminer-package/main.star") + PORT_NAME = "postgresql" APPLICATION_PROTOCOL = "postgresql" +PG_DRIVER = "pgsql" CONFIG_FILE_MOUNT_DIRPATH = "/config" SEED_FILE_MOUNT_PATH = "/docker-entrypoint-initdb.d" @@ -19,6 +22,7 @@ def run( seed_file_artifact_name="", extra_configs=[], persistent=True, + launch_adminer=False, ): """Launches a Postgresql database instance, optionally seeding it with a SQL file script @@ -34,6 +38,7 @@ def run( If not empty, the Postgres server will be populated with the data upon start extra_configs (list[string]): Each argument gets passed as a '-c' argument to the Postgres server persistent (bool): Whether the data should be persisted. Defaults to True; Note that this isn't supported on multi node k8s cluster as of 2023-10-16 + launch_adminer (bool): Whether to launch adminer which launches a website to inspect postgres database entries. Defaults to False. Returns: An object containing useful information about the Postgres database running inside the enclave: ``` @@ -107,6 +112,15 @@ def run( ), ) + if launch_adminer: + adminer = adminer_module.run(plan, + default_db=database, + default_driver=PG_DRIVER, + default_password=password, + default_server=postgres_service.hostname, + default_username=user + ) + url = "{protocol}://{user}:{password}@{hostname}/{database}".format( protocol=APPLICATION_PROTOCOL, user=user,