Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Remove prefix from integrations for Go and FastAPI #53

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion examples/fastapi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

app = FastAPI()

engine = create_engine(os.environ["APP_POSTGRESQL_DB_CONNECT_STRING"], echo=True)
engine = create_engine(os.environ["POSTGRESQL_DB_CONNECT_STRING"], echo=True)

Session = scoped_session(sessionmaker(bind=engine))

Expand Down
2 changes: 1 addition & 1 deletion examples/go/main.go
jdkandersson marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func main() {
Name: "request_count",
Help: "No of request handled",
})
postgresqlURL := os.Getenv("APP_POSTGRESQL_DB_CONNECT_STRING")
postgresqlURL := os.Getenv("POSTGRESQL_DB_CONNECT_STRING")

mux := http.NewServeMux()
mainHandler := mainHandler{
Expand Down
2 changes: 1 addition & 1 deletion examples/go/migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

PGPASSWORD="${APP_POSTGRESQL_DB_PASSWORD}" psql -h "${APP_POSTGRESQL_DB_HOSTNAME}" -U "${APP_POSTGRESQL_DB_USERNAME}" "${APP_POSTGRESQL_DB_NAME}" -c "CREATE TABLE IF NOT EXISTS USERS(NAME CHAR(50));"
PGPASSWORD="${POSTGRESQL_DB_PASSWORD}" psql -h "${POSTGRESQL_DB_HOSTNAME}" -U "${POSTGRESQL_DB_USERNAME}" "${POSTGRESQL_DB_NAME}" -c "CREATE TABLE IF NOT EXISTS USERS(NAME CHAR(50));"
1 change: 0 additions & 1 deletion paas_app_charmer/_gunicorn/wsgi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def __init__( # pylint: disable=too-many-arguments
database_migration=database_migration,
configuration_prefix=f"{workload_config.framework.upper()}_",
framework_config_prefix=f"{workload_config.framework.upper()}_",
integrations_prefix="",
)
self._webserver = webserver

Expand Down
2 changes: 1 addition & 1 deletion paas_app_charmer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__( # pylint: disable=too-many-arguments
database_migration: DatabaseMigration,
framework_config_prefix: str = "APP_",
configuration_prefix: str = "APP_",
integrations_prefix: str = "APP_",
integrations_prefix: str = "",
):
"""Construct the App instance.

Expand Down
24 changes: 12 additions & 12 deletions tests/unit/fastapi/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@
"METRICS_PATH": "/othermetrics",
"APP_SECRET_KEY": "foobar",
"APP_USER_DEFINED_CONFIG": "userdefined",
"APP_POSTGRESQL_DB_CONNECT_STRING": "postgresql://test-username:test-password@test-postgresql:5432/test-database",
"APP_POSTGRESQL_DB_FRAGMENT": "",
"APP_POSTGRESQL_DB_HOSTNAME": "test-postgresql",
"APP_POSTGRESQL_DB_NAME": "test-database",
"APP_POSTGRESQL_DB_NETLOC": "test-username:test-password@test-postgresql:5432",
"APP_POSTGRESQL_DB_PARAMS": "",
"APP_POSTGRESQL_DB_PASSWORD": "test-password",
"APP_POSTGRESQL_DB_PATH": "/test-database",
"APP_POSTGRESQL_DB_PORT": "5432",
"APP_POSTGRESQL_DB_QUERY": "",
"APP_POSTGRESQL_DB_SCHEME": "postgresql",
"APP_POSTGRESQL_DB_USERNAME": "test-username",
"POSTGRESQL_DB_CONNECT_STRING": "postgresql://test-username:test-password@test-postgresql:5432/test-database",
"POSTGRESQL_DB_FRAGMENT": "",
"POSTGRESQL_DB_HOSTNAME": "test-postgresql",
"POSTGRESQL_DB_NAME": "test-database",
"POSTGRESQL_DB_NETLOC": "test-username:test-password@test-postgresql:5432",
"POSTGRESQL_DB_PARAMS": "",
"POSTGRESQL_DB_PASSWORD": "test-password",
"POSTGRESQL_DB_PATH": "/test-database",
"POSTGRESQL_DB_PORT": "5432",
"POSTGRESQL_DB_QUERY": "",
"POSTGRESQL_DB_SCHEME": "postgresql",
"POSTGRESQL_DB_USERNAME": "test-username",
},
id="custom config",
),
Expand Down
40 changes: 20 additions & 20 deletions tests/unit/go/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,26 @@
"APP_BASE_URL": "https://paas.example.com",
"HTTP_PROXY": "http://proxy.test",
"http_proxy": "http://proxy.test",
"APP_REDIS_DB_CONNECT_STRING": "redis://10.1.88.132:6379",
"APP_REDIS_DB_FRAGMENT": "",
"APP_REDIS_DB_HOSTNAME": "10.1.88.132",
"APP_REDIS_DB_NETLOC": "10.1.88.132:6379",
"APP_REDIS_DB_PARAMS": "",
"APP_REDIS_DB_PATH": "",
"APP_REDIS_DB_PORT": "6379",
"APP_REDIS_DB_QUERY": "",
"APP_REDIS_DB_SCHEME": "redis",
"APP_RABBITMQ_HOSTNAME": "rabbitmq.example.com",
"APP_RABBITMQ_PASSWORD": "test-password",
"APP_RABBITMQ_USERNAME": "go-app",
"APP_RABBITMQ_VHOST": "/",
"APP_RABBITMQ_CONNECT_STRING": "amqp://go-app:test-password@rabbitmq.example.com/%2f",
"APP_RABBITMQ_FRAGMENT": "",
"APP_RABBITMQ_NETLOC": "go-app:test-password@rabbitmq.example.com",
"APP_RABBITMQ_PARAMS": "",
"APP_RABBITMQ_PATH": "/%2f",
"APP_RABBITMQ_QUERY": "",
"APP_RABBITMQ_SCHEME": "amqp",
"REDIS_DB_CONNECT_STRING": "redis://10.1.88.132:6379",
"REDIS_DB_FRAGMENT": "",
"REDIS_DB_HOSTNAME": "10.1.88.132",
"REDIS_DB_NETLOC": "10.1.88.132:6379",
"REDIS_DB_PARAMS": "",
"REDIS_DB_PATH": "",
"REDIS_DB_PORT": "6379",
"REDIS_DB_QUERY": "",
"REDIS_DB_SCHEME": "redis",
"RABBITMQ_HOSTNAME": "rabbitmq.example.com",
"RABBITMQ_PASSWORD": "test-password",
"RABBITMQ_USERNAME": "go-app",
"RABBITMQ_VHOST": "/",
"RABBITMQ_CONNECT_STRING": "amqp://go-app:test-password@rabbitmq.example.com/%2f",
"RABBITMQ_FRAGMENT": "",
"RABBITMQ_NETLOC": "go-app:test-password@rabbitmq.example.com",
"RABBITMQ_PARAMS": "",
"RABBITMQ_PATH": "/%2f",
"RABBITMQ_QUERY": "",
"RABBITMQ_SCHEME": "amqp",
},
),
],
Expand Down
Loading