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
.
Ciao Mircea
So to set your Author name you can use personal.st script from my gist available here.
If you want to set up your credentials, you should create a similar startup action with:
MCRepositoryGroup default repositories
select: [:each |
(each isKindOf: MCHttpRepository) and:
[each location includesSubstring: 'smalltalkhub.com' ]]
thenDo: [ :repo |
repo
user: 'your_user_name';
password: 'your_secret_password' ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With