-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing default configuration values #66
Comments
Hi @emilv , You can define several accounts inside the If you are only using one account you don't have to add any account information inside the You usually don't have to use Client::setConfig() at all - only if you want to manipulate configs during the runtime.. Hope I could help :) Update: |
I don't care about the default account. The confusion here is that the only config keys you are allowed to set are those that are defined on the default account. Look again on my example. I removed host, username and password from the default account. That makes it impossible to set those same values on the grappling account. This is a leaky abstraction. Instead of letting the code itself know valid config keys you rely on the `default account to have those keys. |
Ah I see. Yes you're right. I will move to a fixed config set - something like this: public function setConfig(array $config) {
$defaultAccount = config('imap.default');
$defaultConfig = config("imap.accounts.$defaultAccount");
$availableConfig = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password'];
foreach($availableConfig as $key){
$this->$key = isset($config[$key]) ? $config[$key] : $defaultConfig[$key];
}
return $this;
} |
Hi @emilv , Ref.: v. 1.0.5.5 |
The library assumes that there will exist a default account, and that account must have all properties configured.
In particular I tried to use this configuration:
But in Client::setConfig only configuration properties from the default account will ever be set.
Expected behavior is that all the values from both
grappling
are used, with default values fromdefault
.The text was updated successfully, but these errors were encountered: