Codeception - can't use DB module, because of invalid configuration - sqlite

I've added DB module to acceptance suite.
And I've put:
modules:
config:
Db:
dsn: 'sqlite:storage/database.sqlite'
user:
password:
dump: tests/_data/dump.sql
in codeception.yml
Then i need to build:
cept build gives me:
[Codeception\Exception\ModuleConfig]
Db module is not configured!
Options: dsn, user, password are required
Please, update the configuration and set all the required fields
It's the same when I set user and password for dummy values.
I think sqlite doesn't need user and password - I can't get it work. I would appreciate any help, I'm clearly missing something.

You should set the user and password to empty values '' instead of nothing:
Db:
dsn: 'sqlite:storage/database.sqlite'
user: ''
password: ''
dump: tests/_data/dump.sql

try
modules:
enabled: [Db]
config:
Db:
dsn: 'sqlite:storage/database.sqlite'
user:
password:
dump: tests/_data/dump.sql

Db module requires user and password, these have filled

Related

spinnaker rbac with ldap: can't get correct role by email UserDnAttribute

Is that possible to login with the email address and then get the correct roles provided by ldap of the email login ? If the answer is Yes, how to configure it? Please help me, thank you guys!!!
Cloud Provider(s):
k8s v2
Environment:
spinnaker 1.19.2
Feature Area:
helm3 install
halyard config:
authn:
ldap:
enabled: true
url: ldap://URL:port
userSearchBase: dc=test,dc=com
userDnPattern: mail={0},ou=Users
userSearchFilter: (&(mail={0})(employeeType=1)(|(memberOf=cn=admins,ou=Groups,dc=test,dc=com)(memberOf=cn=devs,ou=Groups,dc=test,dc=com)(memberOf=cn=tests,ou=Groups,dc=test,dc=com)))
managerDn: cn=manager,dc=test,dc=com
managerPassword: password
authz:
groupMembership:
service: LDAP
ldap:
roleProviderType: LDAP
url: ldap://URL:port/dc=test,dc=com
managerDn: cn=manager,dc=test,dc=com
managerPassword: password
userSearchBase: dc=test,dc=com
userDnPattern: cn={0},ou=Users
groupSearchBase: ou=Groups
groupSearchFilter: (uniqueMember={0})
groupRoleAttributes: cn
enabled: true

Nonexistent parameter in Swiftmailer

In an attempt to configure both a memory & a spool mailer in a Symfony 4.3 application I followed the docs to create this configuration:
swiftmailer:
default_mailer: memory
mailers:
memory:
sender_address: 'admin#bogus.info'
transport: smtp
username: admin#bogus.info
password: 123Abcd
host: localhost
spool: { type: 'memory' }
spooler:
sender_address: 'admin#bogus.info'
transport: smtp
username: admin#bogus.info
password: 123Abcd
host: localhost
spool:
type: file
path: '%kernel.project_dir%/var/spool'
And in services.yaml:
App\Services\Emailer:
$spoolMailer: '%swiftmailer.mailer.spooler%'
$defaultMailer: '%swiftmailer.default_mailer%'
$senderAddress: '%swiftmailer.mailer.memory_mailer.sender_address%'
$projectDir: '%kernel.project_dir%'
But with those four parameters in the service the following occurs with php bin/console debug:container:
The service "App\Services\Emailer" has a dependency on a non-existent
parameter "swiftmailer.mailer.spooler"...
Why does this configuration not work?
The service "App\Services\Emailer" has a dependency on a non-existent parameter "swiftmailer.mailer.spooler"...
Surrounding parameters with the % symbol allows you to pass values to your services.
As you want to inject a service, you should prefix your parameter with the # symbol.
Also, to get the default mailer service, you have to inject #swiftmailer.mailer
EDIT: Proper way to retrieve the sender address: %swiftmailer.mailer.memory.sender_address%
Updated service definition :
App\Services\Emailer:
$spoolMailer: '#swiftmailer.mailer.spooler'
$defaultMailer: '#swiftmailer.mailer'
$senderAddress: '%swiftmailer.mailer.memory.sender_address%'
$projectDir: '%kernel.project_dir%'

Can't send E-Mails with symfony and swiftmailer using SMTP Server

when I try to send an e-Mail I get the error:
Exception occurred while flushing email queue: Connection could not be
established with host w00d8ef1.kasserver.com [ #0]
.env
MAILER_URL=smtp://w00d8ef1.kasserver.com:25?encryption=ssl&auth_mode=login&username=myusername&password=mypassword
swiftmailer.yaml
swiftmailer:
url: '%env(MAILER_URL)%'
spool: { type: 'memory' }
Controller:
$message = (new Swift_Message('Test'))
->setFrom('info#lama.resper.de')
->setTo($user->getEmail())
->setBody(
$this->renderView(
'pdf/usercard.html.twig',
['user' => $user]
),
'text/html'
)
;
$mailer->send($message);
Hope someone can help me. The Mailserver is running.
Are you sure that you are using the right port number for smtp? Generally, it runs on 465 or 587. So, try to change the port number in your MAILER_URL env variable.
symfony 4.3
try .env file loks like
MAILER_URL=smtp://YOURDOMAIN.COM:465?encryption=ssl&auth_mode=login&username=USEREMAIL#DOMAIN.COM&password=YOURPASSWORD
in config/packages/dev/swiftmailer.yaml (for dev env)
insert:
swiftmailer:
transport: smtp
username: user#domain.pl
password: 'yourpasswor{$##'
host: mail.yourdomain.pl
port: 465
encryption: ssl
auth-mode: login
spool: { type: 'memory' }
stream_options:
ssl:
allow_self_signed: true
verify_peer: false
verify_peer_name: false
use
php bin/console debug:config swiftmailer
to checkout your config
same for production yaml file (but ssl shoud not be self signed)

Sending Email in Symfony 3 in dev mode

In need help learning how to send email in development mode using the Symfony framework with the Swift_mailer library.
Here is my config_dev.yml file:
swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
username: '%mailer_user%'
password: '%mailer_password%'
spool: { type: memory }
And my config.yml file:
swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
username: '%mailer_user%'
password: '%mailer_password%'
spool: { type: memory }
And my parameters.yml file:
....
mailer_transport: gmail
mailer_host: 127.0.0.1
mailer_user: 'my_gamil_here'
mailer_password: 'my_password_here'
Then in my controller I have the following:
public function indexAction(\Swift_Mailer $mailer)
{
$message = (new \Swift_Message('Hello Email'))
->setFrom('westtexascentral555#gmail.com')
->setTo('kaleyaw#yahoo.com')
->setBody(
$this->renderView(
// app/Resources/views/Emails/registration.html.twig
'Emails/registration.html.twig',
array('name' => 'James')
),
'text/html'
);
$mailer->send($message);
return new Response('Email sent');
}
Can Someone tell me what I'm going wrong. Nothing gets sent to the email account.
Maybe it's because you specified mailer host as localhost. Check this symfony docs http://symfony.com/doc/current/email/gmail.html. And pay attention to this part:
The gmail transport is simply a shortcut that uses the smtp transport
and sets these options:
encryption ssl
auth_mode login
host smtp.gmail.com
Make sure, that mailer_user is set only to your gmail username (without host part). Let's say if I have email myemail#gmail.com, my username would be myemail.
Are you using 2-step verification for your gmail account? If so, additionally you need to generate app password for your account, as specified in docs:
If your Gmail account uses 2-Step-Verification, you must generate an App password and use it as the value of the mailer_password parameter. You must also ensure that you allow less secure apps to access your Gmail account.
Shortly, you can follow here, login, select app (in this case Mail) and the device you want to use mailer with, press Generate and you will see modal with your app password, similar to this snub udpz xcvt jrdp. Copy this password, and use it as your gmail password (without spaces).
If this doesn't help, also check logs, usually if there is a problem with smtp server, swiftmailer prints error to the logs.
'mailer_transport' is the protocole to send mails.
Try to use 'smtp' instead 'gmail' :)

Snc Redis bundle set password in config.yml

I set a password on my local redis server, but it gives the following error:
"NOAUTH Authentication required."
How can I configure a Redis password in config.yml?
You can specify it in your dsn config.
snc_redis:
clients:
default:
type: predis
alias: default
dsn: 'redis://%redis_session_secret%#%redis_host%:%redis_port%'
For me this DSN format worked:
redis://127.0.0.1?password=yourpass
snc_redis:
clients:
default:
type: predis
alias: default
dsn: 'redis://127.0.0.1?password=yourpass'
Found in Wiki https://github.com/nrk/predis/wiki/Connection-Parameters

Resources