aderaaij / wp-vercel-deploy-hooks

WordPress Plugin to trigger Vercel deploy hooks on command / update
GNU General Public License v3.0
71 stars 18 forks source link

Add ability to set value in wp-config #11

Closed fembuelita closed 2 years ago

fembuelita commented 2 years ago

Addresses https://github.com/aderaaij/wp-vercel-deploy-hooks/issues/10. It also cleaned up some spacing, adding a missing </div>, and removed the trailing white space from EOF

Readme is updated with an example. Here is another example of usage specific for use with Pantheon by setting your wp-config.php file:


switch ($_ENV['PANTHEON_ENVIRONMENT']) {
    case "live":
        if(!defined( "WP_ENVIRONMENT_TYPE" )) {
            define( 'WP_ENVIRONMENT_TYPE', 'live' );
        }
        define( 'WP_VERCEL_WEBHOOK_ADDRESS', 'https://api.vercel.com/v1/integrations/deploy/.../...' );
        break;

    case "test":
        if(!defined( "WP_ENVIRONMENT_TYPE" )) {
            define( 'WP_ENVIRONMENT_TYPE', 'staging' );
        }
        define( 'WP_VERCEL_WEBHOOK_ADDRESS', 'https://api.vercel.com/v1/integrations/deploy/.../...' );
        break;

    case "dev":
        if(!defined( "WP_ENVIRONMENT_TYPE" )) {
            define( 'WP_ENVIRONMENT_TYPE', 'development' );
        }
        define( 'WP_VERCEL_WEBHOOK_ADDRESS', 'https://api.vercel.com/v1/integrations/deploy/.../...' );
        break;
    default:
        if(!defined( "WP_ENVIRONMENT_TYPE" )) {
            define( 'WP_ENVIRONMENT_TYPE', 'local' );
        }
        define( 'WP_VERCEL_WEBHOOK_ADDRESS', 'https://api.vercel.com/v1/integrations/deploy/.../...' );
        break;
}
fembuelita commented 2 years ago

Tagging @aderaaij for review and merge request

aderaaij commented 2 years ago

This seems like excellent work @elliottpost! I'll try and have a look at it asap and also make a new release if all is well. I hope to do this tomorrow but it could be at the start of next week. Thank you for the PR!

fembuelita commented 2 years ago

Thanks! If the auto code refactor my IDE lint program employed is a pain for your QA just let me know and I can do another PR with just the relevant changes by using Sublime.

aderaaij commented 2 years ago

@elliottpost Apologies for not getting to this after all this time. I completely forgot about it but I'll merge it asap. Thanks again

fembuelita commented 2 years ago

Glad it worked out @aderaaij! 🎉