Page MenuHomePhabricator

Support reading Wiki Replica/ToolsDB credentials from envvars
Closed, ResolvedPublicFeature

Description

Follow up T265691: [tbs.maintaindbusers] Update maintain-dbusers to create an envvar with replica.my.cnf to be used by buildpack images by making the python-toolforge library use the envvar values when present rather than loading the replica.my.cnf file from disk.

Event Timeline

Curious, what would it take to make this happen?

Curious, what would it take to make this happen?

The current connection logic is in https://gitlab.wikimedia.org/toolforge-repos/python-toolforge/-/blob/main/src/toolforge/__init__.py?ref_type=heads#L75-82. https://wikitech.wikimedia.org/wiki/Help:Toolforge/Building_container_images#Connecting_to_ToolsDB_and_the_Wiki_Replicas is the current documentation for the envvars replacement.

The library needs a small amount of refactoring to take advantage of the newly split envvar credentials for Wiki Replicas vs ToolsDB. It seems like a reasonable implementation of the connect logic would check for the specific username and password envvars for the desired backend, use them if found, and fallback to the the current ~/replica.my.cnf logic if not.