Get settings in a route

How to get the configurations from the container, when I use AppFactory::createFromContainer(), to create the container in the app with its dependencies.
Can you help me, please?

Hi @odan, this is my code in file settings.php

<?php // Should be set to 0 in production error_reporting(E_ALL); // Should be set to '0' in production ini_set('display_errors', '1'); $settings = [ 'app_settings' => [ 'app_code' => 'gbnet01', 'app_name' => 'gbnet-sar', 'propietario' => 'Globalnet Systems' ], 'db_settings' => [ "DB_NAME" => "apihospital", "DB_PASS" => "Aguila17.", "DB_CHAR" => "utf8", "DB_HOST" => "localhost", "DB_USER" => "jlramirez", ] ]; return $settings; ?>

this code in container.php

<?php use Psr\Container\ContainerInterface; use Slim\App; use Slim\Factory\AppFactory; return [ 'settings' => function () { return require __DIR__ . '/settings.php'; }, App::class => function (ContainerInterface $container) { $app = AppFactory::createFromContainer($container); // Register routes (require __DIR__ . '/routes.php')($app); // Register middleware (require __DIR__ . '/middleware.php')($app); return $app; }, ]; ?>

this is my route
$app->get(‘/hello/{name}’, function (ServerRequestInterface $request, ResponseInterface $response, array $args){
$name = $args[‘name’];
$config = $this->get(‘db_settings’);
echo 'propietario: '.$config->propietario;
$response->getBody()->write(“Hello, $name”);

  return $response;

});

Can you please tell me what I am doing wrong? I want to bring all the values ​​from my container and be able to use them in any route

To get the settings within a Route callback you can use this example:

$settings = $this->get('settings');