contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

Bring back the app_dev.php #23

Closed Toflar closed 7 years ago

Toflar commented 7 years ago

Or how am I supposed to enable the debug mode to dump template variables and see the template names that were used etc.?

aschempp commented 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.

Toflar commented 7 years ago

It is already very helpful without a password because if you have it on localhost, no password check is required.

qzminski commented 7 years ago

Why not add it automatically but only if it does not exist?

aschempp commented 7 years ago

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?

Toflar commented 7 years ago

Imho this should just be an option of the install-web-dir command :)

aschempp commented 7 years ago

valid point 😎

So I would suggest:

  1. contao:install-web-dir will add app_dev.php but without password (= works on localhost only)
  2. contao:install-web-dir --password will interactively ask for password
  3. contao:install-web-dir --password=foobar will create app_dev.php with password foobar
  4. contao:install-web-dir --no-dev will remove/not install app_dev.php

?

Toflar commented 7 years ago

Absolutely perfect plan! 👍

discordier commented 7 years ago

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.

aschempp commented 7 years ago

@discordier should be as simple as contao:install-web-dir --password <<< "$your_variable" or echo "$your_variable" | contao:install-web-dir --password?

discordier commented 7 years ago

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.

Toflar commented 7 years ago

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.

discordier commented 7 years ago

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).

aschempp commented 7 years ago

So you mean reading it from ENV at runtime, not pass it to the command?

Toflar commented 7 years ago

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');
aschempp commented 7 years ago

see #33