Is there a way of setting the SmalltalkHub username and password in an environment variable or an external configuration file as opposed to setting them in every repository in every image? It gets old introducing them always.
This is the solution I eventually found.
The MCHTTPRepository>>userAndPasswordFromSettingsDo:
already has machinery for using credentials. It looks them up in the MCRepository.Settings
class variable where it expects to find a Dictionary. Unfortunately that class variable is never set nor referenced anywhere in the image. There is also no accessor for it.
Thus, we patch the class with an accessor method for Settings
and then set the account information in a startup script:
StartupLoader default executeAtomicItems: {
StartupAction
name: 'Accounts'
code: [
Author fullName: 'AuthorName'.
MCRepository class compile: 'settings ^Settings ifNil: [ Settings := Dictionary new.]'.
MCRepository settings
at: 'account1'
put: '*smalltalkhub.com* username:password' ]
runOnce: true
}
As in @Uko's example, the script should be in in ~/Library/Preferences/pharo
.