Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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

Expand All @@ -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:
```
Expand Down Expand Up @@ -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,
Expand Down