Skip to content

Conversation

@midhunmonachan
Copy link
Contributor

  • Bug fix: No bugs were fixed in this release.

  • New feature: Add some UI enhancements for provision.

    • mainly affects recipe/provision, recipe/laravel, provision/php
    • [recipe/laravel] add default laravel public_path config value
    • [provision/php] set default php_version from composer.json (if available) in the ask prompt
    • [recipe/provision] remove unnecessary print lines for provision:configure
    • [recipe/provision] avoid prompt for database info if database type is none
    • [recipe/provision] add confirmation to continue provision in unsupported OS
  • BC breaks: No backward compatibility breaks in this release.

  • Tests added: No new tests were added in this release.

  • Docs added: No new documentation was added in this release.

'db_password',
];
$code = "\n\n host(<info>'{{alias}}'</info>)";
foreach ($params as $name) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we keep printing those code parts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it was left over from development.

Always prints this:

host('your_hostname_here')
 ->set('sudo_password', '')
 ->set('domain', '')
 ->set('public_path', '')
 ->set('php_version', '')
 ->set('db_type', '')
 ->set('db_user', '')
 ->set('db_name', '')
 ->set('db_password', '');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we keep printing those code parts?

Hi @antonmedv, I just noticed this code was put back in the master. Just curious, what's the purpose of printing those in the output?

Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

So users can cope pase those and put into deploy.php.

Copy link
Contributor Author

@midhunmonachan midhunmonachan May 21, 2024

Choose a reason for hiding this comment

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

If that's the case, I want to point out couple things.

We are printing lines for only $params array now. I split the $params array to $dbparams to aid in asking database info only if the database type is not none

So, if you need all the parameters output like before, I would modify it to:

    $params = [
        'sudo_password',
        'domain',
        'public_path',
        'php_version',
        'db_type',
    ];
    $dbparams = [
        'db_user',
        'db_name',
        'db_password',
    ];
    $code = "\n\n    host(<info>'{{alias}}'</info>)";
    foreach (array_merge($params, $dbparams) as $name) {
        $code .= "\n        ->set(<info>'$name'</info>, <info>'…'</info>)";
    }
    $code .= ";\n\n";
    writeln($code);
});

In this, the array_merge function will combine $params and $dbparams into a single array, which is then iterated over to generate the configuration code. This way, all parameters from both arrays will be included in the output.


Also, I think it would be helpful to include a message just before printing it.

For example, "To avoid entering parameters during script execution, include the following config with values in your deploy.php"


Also, I would be careful when including sudo password and database info in a config file. If the user publishes the config to a public repository, it won't be good.

Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

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

Good suggestions. PR?

@antonmedv antonmedv merged commit 6e7bad7 into deployphp:master May 21, 2024
midweste pushed a commit to midweste/deployer that referenced this pull request Jun 1, 2024
* origin/master: (40 commits)
  Improve the configuration options console output in provision:configure (deployphp#3840)
  Update Craft CMS deploy recipe (deployphp#3839)
  [automatic] Update docs with bin/docgen
  Update provision.php
  Feature/UI enhancements (deployphp#3835)
  Hotfix/v7.4.0: Fixes caddyfile and realpath errors in provision:website (deployphp#3837)
  [automatic] Update docs with bin/docgen
  docs(recipe/shopware): add code syntax highlighting (deployphp#3834)
  [automatic] Update docs with bin/docgen
  docs(recipe/magento2): fix typo in conccurent (deployphp#3830)
  [automatic] Update docs with bin/docgen
  magento2 theme processing fix for 3786 (deployphp#3818)
  use md5 of task name for section id in gitlab ci (deployphp#3817)
  [automatic] Update docs with bin/docgen
  Magento 2: Changed upgrading database (deployphp#3812)
  [automatic] Update docs with bin/docgen
  Shopware: Added `deploy:update_code` (deployphp#3816)
  [automatic] Update docs with bin/docgen
  Update nodejs to LTS version (deployphp#3815)
  Update LICENSE
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants