How to connect magento 2 to Redis - docker

I have a magento 2 installation on docker, i would like to work with redis api, but not for magento2's session or page caching.
I would like to use the get() and set() commands to store strings, hash tables and many more.
Majorly what i need is a way to connect to a redis installed on docker instance that is on the same network as a magento 2 installation which is also on docker.
Thanks in advance.

I'm using Redis docker, maybe this will help you:
'session' => [
'save' => 'redis',
'redis' => [
'host' => 'redis',
'port' => '6379',
'password' => '',
'timeout' => '2.5',
'persistent_identifier' => '',
'database' => '0',
'compression_threshold' => '2048',
'compression_library' => 'gzip',
'log_level' => '1',
'max_concurrency' => '10',
'break_after_frontend' => '5',
'break_after_adminhtml' => '30',
'first_lifetime' => '600',
'bot_first_lifetime' => '60',
'bot_lifetime' => '7200',
'disable_locking' => '1',
'min_lifetime' => '60',
'max_lifetime' => '2592000'
]
],
'cache' => [
'frontend' => [
'default' => [
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => [
'server' => 'redis',
'database' => '1',
'port' => '6379'
]
]
]
],
Regards

Related

getting wrong user with laravel sanctum

I am using Laravel Sanctum to provide a personal access token to my clients.
I am using these guards in auth.php:
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'client' => [
'driver' => 'token',
'provider' => 'clients',
'hash' => false
]
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'clients' => [
'driver' => 'eloquent',
'model' => App\Models\Client::class,
],
],
I give my clients tokens using the following code:
$client = Client::find($id);
$token = $client->createToken('CLIENT_TOKEN');
but whenever I try to access the user with $request->user() I get the wrong user. while the token is completely different from what the retrieved user is.
I am using laravel-swoole package as my webserver.

How to send messages using AWS Pinpoint service using PHP SDK

Hi I am trying to send a message using AWS Pinpoint with the PHP SDK, but I am getting an error. Any ideas why? Here is my code:
$client = new PinpointClient([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => [
'key' => 'MYIAMAWSKEY',
'secret' => 'MYAWSSECRET',
]
]);
$result = $client->sendMessages([
'ApplicationId' => 'MyAppId',
'MessageRequest' => [
'Addresses' => [
'AnIOSDeviceToken' => [
'BodyOverride' => 'aaa',
'ChannelType' => 'APNS',
'RawContent' => 'bbb',
'Context' => ['ccc' => '222'],
'TitleOverride' => 'ddd',
],
],
],
'MessageConfiguration' => [
'APNSMessage' => [
'Action' => 'OPEN_APP',
'Body' => 'Hello',
'RawContent' => 'World',
'SilentPush' => false,
'Title' => 'Hello World!!!',
],
],
]);
I get the following error:
DeliveryStatus: 'PERMANENT_FAILURE'
StatusCode: 400
StatusMessage: Invalid notification: Notification is malformed
According to the API Docs, 'MessageConfiguration' needs to be inside the 'MessageRequest' field. Please make sure your input parameters fully match the documented API Parameter Syntax.

How configurate the certificate of php 5.6 in SmtpTransport of ZEND 2?

Using phpMailer the config is that (it is working):
$mail->SMTPOptions = array (
'ssl' => array(
'verify_peer' => true,
'verify_depth' => 3,
'allow_self_signed' => true,
'peer_name' => 'smtp.rei.unicamp.br',
'cafile' => '/var/www/apache/conf/certs/cadeia-completa-globalsign.pem',
)
My old configuration of Smtp are (it is working in php versions before 5.6):
$options = new SmtpOptions(array(
'name' => $name,
'host' => $host,
'port' => 587,
'connection_class' => 'plain',
'connection_config' => array(
'username' => 'test',
'password' => 'test123',
'ssl' => 'tls',
),
Anyone knows how I put the first configuration on the SmtpOptions of Zend 2?
Thank you!!

How do I tell a Rails 4 app where my SSL certs are?

I'm trying to tell a Rails 4 app where to find the SSL certificates.
Ww got it working by modifying the bin/rails, adding this
if ENV['SSL'] == "true"
module Rails
class Server < ::Rack::Server
def default_options
super.merge({
:Port => 443,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru"),
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLPrivateKey => OpenSSL::PKey::RSA.new(
File.open("/path/to/my/private/.key").read),
:SSLCertificate => OpenSSL::X509::Certificate.new(
File.open("/path/to/my.cert").read),
:SSLCertName => [["CN", WEBrick::Utils::getservername]],
})
end
end
end
end
all good but I want these setting in my config/environments/staging.rb file instead, and I want it to be non-specific to Webbrick.
Is this the right approach, and
if so, how do I move these settings into config/environments/staging.rb?
The consensus from the comments is:
No, and
see 1.
Thanks #tpbowden and #josh-deeden for your quick responses.

How to update groupings via Mailchimp API?

I'm trying to subscribe and update members of a Mailchimp list from my Rails 3.2 app via the API.
Everything is working fine, except that I am unable to set interest groups.
What is the correct format for setting groupings.
I've tried
merge_vars: 'GROUPINGS' => [
[
'id' => group_id,
'groups' => ['array', 'of', 'groups']
]
]
and
merge_vars: 'GROUPINGS' => [
[
'id' => group_id,
'groups' => "comma,separated,groups"
]
]
and
merge_vars: 'GROUPINGS' => [
0 => [
'id' => group_id,
'groups' => "comma,separated,groups"
]
]
and several other variations.
Nothing seems to work and the docs are unclear
Took me some time but I finnaly figured out the correct format :
#gb.lists.subscribe({:id => list_id,
:email => {:email => self.email},
:merge_vars => {:FNAME => self.firstname,
:groupings => [{:id => grouping_id,
:groups => ["name","of","groups"]
}]
},
:double_optin => false,
:send_welcome => false,
:update_existing => true})
I'm using rails 3.1.11 and gibbon 0.5.0
Hope this will help !

Resources