From 94fcae42550f00eeedf3ff22ab2b7f32b3058355 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Jul 2026 05:53:14 +0000 Subject: [PATCH 1/2] Initial plan From 7ea8c23e7ccfc8f927e9642c773925ddcdab9d82 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Jul 2026 06:21:37 +0000 Subject: [PATCH 2/2] Remove hard-coded credentials from docker-compose.yml via env vars --- .env.example | 16 ++++++++++++++++ .gitignore | 3 +++ README.md | 7 ++++--- docker-compose.yml | 16 ++++++++-------- 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..4efbec98 --- /dev/null +++ b/.env.example @@ -0,0 +1,16 @@ +# Copy this file to ".env" and set your own values before running docker compose. +# docker compose automatically reads the ".env" file in this directory and +# substitutes these values into docker-compose.yml. The ".env" file is +# git-ignored so real credentials are never committed to the repository. + +# PostgreSQL database credentials (used by the "db", "ua-cloudlibrary" and "pgadmin" services) +POSTGRESQL_USERNAME=uacloudlib +POSTGRESQL_PASSWORD=uacloudlib +POSTGRESQL_DATABASE=uacloudlib + +# Password for the built-in UA Cloud Library admin ("service") account +SERVICE_PASSWORD=uacloudlib + +# pgAdmin login credentials +PGADMIN_DEFAULT_EMAIL=no-reply@opcfoundation.org +PGADMIN_DEFAULT_PASSWORD=uacloudlib diff --git a/.gitignore b/.gitignore index 92b8b688..fe3941a4 100644 --- a/.gitignore +++ b/.gitignore @@ -358,3 +358,6 @@ launchSettings.json /UACloudLibraryServer/key-*.xml /UACloudLibraryServer/pki + +# Local docker compose environment file with credentials (never commit) +.env diff --git a/README.md b/README.md index 4c9e29ec..ef3590d7 100644 --- a/README.md +++ b/README.md @@ -103,11 +103,12 @@ For complete documentation and examples, see the [Client Library README](Opc.Ua. ## Development Setup -Start development in three simple steps: +Start development in a few simple steps: 1. Checkout ``git clone https://github.com/OPCFoundation/UA-CloudLibrary.git`` -2. Open with Visual Studio 2019+ -3. Select ``docker-compose`` as startup project and hit F5 or the "play button" +2. Copy ``.env.example`` to ``.env`` and set your own credentials. ``docker compose`` reads this file and injects the values into ``docker-compose.yml``. The ``.env`` file is git-ignored so credentials are never committed. +3. Open with Visual Studio 2019+ +4. Select ``docker-compose`` as startup project and hit F5 or the "play button" The OPC UA CloudLib Website opens in the browser. diff --git a/docker-compose.yml b/docker-compose.yml index 33277a5e..cd2fc266 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,8 @@ services: uanet: ipv4_address: 10.6.0.20 environment: - ConnectionStrings__CloudLibraryPostgreSQL: "Server=db;Username=uacloudlib;Password=uacloudlib;Database=uacloudlib;Port=5432;Ssl Mode=Prefer" - ServicePassword: uacloudlib + ConnectionStrings__CloudLibraryPostgreSQL: "Server=db;Username=${POSTGRESQL_USERNAME};Password=${POSTGRESQL_PASSWORD};Database=${POSTGRESQL_DATABASE};Port=5432;Ssl Mode=Prefer" + ServicePassword: ${SERVICE_PASSWORD} PostgreSQLEndpoint: db APIKeyAuth: "true" db: @@ -25,9 +25,9 @@ services: uanet: ipv4_address: 10.6.0.21 environment: - POSTGRES_PASSWORD: uacloudlib - POSTGRES_USER: uacloudlib - POSTGRES_DB: uacloudlib + POSTGRES_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRES_USER: ${POSTGRESQL_USERNAME} + POSTGRES_DB: ${POSTGRESQL_DATABASE} pgadmin: image: "dpage/pgadmin4" container_name: pgadmin @@ -37,8 +37,8 @@ services: uanet: ipv4_address: 10.6.0.22 environment: - PGADMIN_DEFAULT_EMAIL: no-reply@opcfoundation.org - PGADMIN_DEFAULT_PASSWORD: uacloudlib + PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL} + PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD} PGADMIN_CONFIG_SERVER_MODE: "False" PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" volumes: @@ -46,7 +46,7 @@ services: entrypoint: - "/bin/sh" - "-c" - - "/bin/echo 'db:5432:*:uacloudlib:uacloudlib' > /tmp/pgpassfile && chmod 600 /tmp/pgpassfile && /entrypoint.sh" + - "/bin/echo 'db:5432:*:${POSTGRESQL_USERNAME}:${POSTGRESQL_PASSWORD}' > /tmp/pgpassfile && chmod 600 /tmp/pgpassfile && /entrypoint.sh" restart: unless-stopped networks: