Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
// Lookup-Server Config

$CONFIG = [
// Application BASE Path. If the application is located under a subpath, define the path here.
'BASE_PATH' => '/lookup-server',

//DB
'DB' => [
'host' => 'localhost',
Expand Down
7 changes: 4 additions & 3 deletions server/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@


require __DIR__ . '/vendor/autoload.php';
$settings = require __DIR__ . '/src/config.php';

$container = new Container();
AppFactory::setContainer($container);
$app = AppFactory::create();
$app->setBasePath('');

$settings = require __DIR__ . '/src/config.php';
$container->set('Settings', function (Container $c) use ($settings) {
return $settings;
});

$basePath = $settings['settings']['base_path'] ?? '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we confirm the validity of the path if not empty ?

$app->setBasePath($basePath);

$container->set('DependenciesService', function (Container $c) {
return new DependenciesService($c->get('Settings'));
});
$container->get('DependenciesService')->initContainer($container, $app);

1 change: 1 addition & 0 deletions server/src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'settings' => [
'displayErrorDetails' => true,
'addContentLengthHeader' => true,
'base_path' => $CONFIG['BASE_PATH'] ?? '',
'db' => [
'host' => $CONFIG['DB']['host'] ?? 'localhost',
'user' => $CONFIG['DB']['user'] ?? 'lookup',
Expand Down