-
-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
One of the very few things that prevents Nette application from beeing compiled before deployment (and therefore using it on readonly filesystems) are hardcoded absolute paths in DI Container.
Now imagine if you were to tell the container the root directory of the project.
// this ofcourse could be autoresolved by default, but the setter should be available
$configurator->setRootDir(dirname(__DIR__)); // dirname(%appDir%)Now that we have the absolute path, we can set the value "dynamically"
class SystemContainer
{
public function __construct()
{
parent::__construct(array(
// ....
'rootDir' => __DIR__ . '/../..',
));
}
}and the strings in generated container that contain the rootDir string can be replaced with the dynamic value
"/var/www/hosts/kdyby.org/app/../www/images"
$this->parameters['rootDir'] . "/app/../www/images"This is merely a concept and there are other obstacles, but IMHO this is the main one. Composer uses the same concept for the generated autoloader. I think we should do it similarly.
fmasa and JanTvrdik
Metadata
Metadata
Assignees
Labels
No labels