tachibana22 opened a new issue, #99:
URL: https://github.com/apache/incubator-seata-go-samples/issues/99

   **What would you like to be added**:
   1. Remove all hardcoded database literal connection strings (DSNs) from the 
individual sample files across multiple distributed transaction modes.
   2. Refactor the database initializations to use centralized functions from 
the `util` package:
      - Use `util.GetAtMySqlDb()` for AT mode samples (e.g., `at/gorm`, 
`at/grpc`).
      - Use `util.GetXAMySqlDb()` for XA mode samples (e.g., `xa/gorm`).
      - Use `util.GetTccMySqlDb()` for TCC mode samples (e.g., `tcc/fence`).
   3. Leverage the `os.ExpandEnv` mechanism within `util/db.go` to dynamically 
read database configurations via environment variables (`MYSQL_HOST`, 
`MYSQL_PORT`, `MYSQL_USERNAME`, `MYSQL_PASSWORD`, `MYSQL_DB`) while preserving 
fallback defaults for local development compatibility.
   
   **Why is this needed**:
   1. **Environment Decoupling**: Hardcoded literal credentials tightly couple 
the sample code to specific infrastructure instances, preventing them from 
adapting to different external local or remote database configurations without 
altering the source code.
   2. **CI Pipeline Enablement**: This refactoring is a strict prerequisite for 
introducing automated integration testing within GitHub Actions, where database 
containers are spun up dynamically and require parameters to be injected via 
environment variables at runtime.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to