Closed Toflar closed 7 years ago
For now you have to create that file manually. It sure should be possible but we need to store the password somehow to recreate it after an update.
It is already very helpful without a password because if you have it on localhost, no password check is required.
Why not add it automatically but only if it does not exist?
I would suggest to add a command like vendor/bin/contao-console contao:enable-debug --password=foobar
This could later then be used by the Manager to add the entry point?
Imho this should just be an option of the install-web-dir
command :)
valid point 😎
So I would suggest:
contao:install-web-dir
will add app_dev.php
but without password (= works on localhost only)contao:install-web-dir --password
will interactively ask for passwordcontao:install-web-dir --password=foobar
will create app_dev.php
with password foobarcontao:install-web-dir --no-dev
will remove/not install app_dev.php
?
Absolutely perfect plan! 👍
Can I get a "1.1. contao:install-web-dir will add app_dev.php with password from environment variable" please? :smirk: It is common for processes to be able to pass such things as environment variable in order to not make them show up in the process list. Therefore 3. should be considered dangerous and we should provide this 1.1. as well.
@discordier should be as simple as contao:install-web-dir --password <<< "$your_variable"
or echo "$your_variable" | contao:install-web-dir --password
?
AFAIR contao:install-web-dir --password <<< "$your_variable"
will still show up as command currently being executed but I am not sure.
Piping works, however using environment variables has been common for ages and therefore I do not see why we should not implement it as well.
Imho we can add fetching from an env variable to the app_dev.php
. It's easy, not related to the command directly and I like the idea.
This would then mean that you can not set the pass only on deployment but must add it to the environment of the php-fcgi process. This is not always possible, especially not in the target area of contao-manager (shared web hosts).
So you mean reading it from ENV at runtime, not pass it to the command?
So you mean reading it from ENV at runtime, not pass it to the command?
Exactly. So something like this:
$getEnv = function ($key, $default, $type) {
$envValue = getenv($key);
if (false !== $envValue && '' !== $envValue) {
settype($envValue, $type);
return $envValue;
}
return $default;
};
$accessKey = $getEnv('CONTAO_APP_DEV_ACCESS_KEY', '<manager-generated-pass>', 'string');
see #33
Or how am I supposed to enable the debug mode to dump template variables and see the template names that were used etc.?