-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VIP config file #98
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?php | ||
/** | ||
* Hi there, VIP dev! | ||
* | ||
* vip-config.php is where you put things you'd usually put in wp-config.php. Don't worry about database settings | ||
* and such, we've taken care of that for you. This is a good place to define a constant or something of that | ||
* nature. However, consider using environment variables for anything sensitive or environment-specific: | ||
* | ||
* @see https://docs.wpvip.com/how-tos/manage-environment-variables/ | ||
* | ||
* WARNING: This file is loaded very early (immediately after `wp-config.php`), which means that most WordPress APIs, | ||
* classes, and functions are not available. The code below should be limited to pure PHP. | ||
* | ||
* @see https://docs.wpvip.com/technical-references/vip-codebase/vip-config-directory/ | ||
* | ||
* Happy coding! | ||
* | ||
* - The WordPress VIP Team | ||
**/ | ||
|
||
/** | ||
* Redirect non www to www. | ||
* | ||
* @see https://docs.wpvip.com/redirects/domain-redirects-in-vip-config-php/ | ||
*/ | ||
if ( isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ) { | ||
$http_host = $_SERVER['HTTP_HOST']; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | ||
$request_uri = $_SERVER['REQUEST_URI']; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | ||
} | ||
|
||
/** | ||
* Set a high default limit to avoid too many revisions from polluting the database. | ||
* | ||
* @see https://docs.wpvip.com/technical-references/vip-platform/post-revisions/ | ||
* | ||
* Posts with high revisions can result in fatal errors or have performance issues. | ||
* | ||
* Feel free to adjust this depending on your use cases. | ||
*/ | ||
if ( ! defined( 'WP_POST_REVISIONS' ) ) { | ||
define( 'WP_POST_REVISIONS', 100 ); | ||
} | ||
Comment on lines
+31
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this should be moved to Alleyvate. maybe @kevinfodness can weigh in on this? I assume we would want this same approach to employed on Pantheon sites as well as VIP sites. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It comes from https://github.com/Automattic/vip-go-skeleton/blob/production/vip-config/vip-config.php We might want to add it to Alleyvate for non-VIP sites, yes, but for our purposes here we're cloning what VIP is providing us with in their skeleton. Another possibility for how to tackle this would be to actually fetch the latest and greatest from the VIP skeleton repo rather than maintaining a copy here. If installing VIP, then clone skeleton, copy relevant files, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gotcha, thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we should make a separate issue for the automating the download of the VIP Config file. |
||
|
||
/** | ||
* The VIP_JETPACK_IS_PRIVATE constant is enabled by default in non-production environments. | ||
* | ||
* It disables programmatic access to content via the WordPress.com REST API and Jetpack Search; | ||
* subscriptions via the WordPress.com Reader; and syndication via the WordPress.com Firehose. | ||
* | ||
* You can disable "private" mode (e.g. for testing) in non-production environment by setting the constant to `false` below (or just by removing the lines). | ||
* | ||
* @see https://docs.wpvip.com/technical-references/restricting-site-access/controlling-content-distribution-via-jetpack/ | ||
*/ | ||
if ( | ||
! defined( 'VIP_JETPACK_IS_PRIVATE' ) | ||
&& defined( 'VIP_GO_APP_ENVIRONMENT' ) | ||
&& 'production' !== VIP_GO_APP_ENVIRONMENT | ||
) { | ||
define( 'VIP_JETPACK_IS_PRIVATE', true ); | ||
} | ||
|
||
/** | ||
* Disable New Relic Browser instrumentation. | ||
* | ||
* By default, the New Relic extension automatically enables Browser instrumentation. | ||
* | ||
* This injects some New Relic specific javascript onto all pages on the VIP Platform. | ||
* | ||
* This isn't always desireable (e.g. impacts performance) so let's turn it off. | ||
* | ||
* If you would like to enable Browser instrumentation, please remove the lines below. | ||
* | ||
* @see https://docs.newrelic.com/docs/agents/php-agent/features/browser-monitoring-php-agent/#disable | ||
* @see https://docs.wpvip.com/technical-references/tools-for-site-management/new-relic/ | ||
*/ | ||
if ( function_exists( 'newrelic_disable_autorum' ) ) { | ||
newrelic_disable_autorum(); | ||
} | ||
|
||
/** | ||
* Set WP_DEBUG to true for all local or non-production VIP environments to ensure | ||
* _doing_it_wrong() notices display in Query Monitor. This also changes the error_reporting level to E_ALL. | ||
* | ||
* @see https://wordpress.org/support/article/debugging-in-wordpress/#wp_debug | ||
*/ | ||
if ( | ||
! defined( 'WP_DEBUG' ) | ||
&& ( ! defined( 'VIP_GO_APP_ENVIRONMENT' ) || 'production' !== VIP_GO_APP_ENVIRONMENT ) | ||
) { | ||
define( 'WP_DEBUG', true ); | ||
} | ||
|
||
// Enable VIP Search. | ||
define( 'VIP_ENABLE_VIP_SEARCH', true ); | ||
define( 'VIP_ENABLE_VIP_SEARCH_QUERY_INTEGRATION', true ); | ||
|
||
// Set up VIP Search locally. | ||
if ( ! defined( 'VIP_GO_APP_ENVIRONMENT' ) || 'local' === VIP_GO_APP_ENVIRONMENT ) { | ||
define( 'VIP_ELASTICSEARCH_ENDPOINTS', [ 'http://localhost:9200' ] ); | ||
define( 'VIP_ELASTICSEARCH_USERNAME', 'username' ); | ||
define( 'VIP_ELASTICSEARCH_PASSWORD', 'password' ); | ||
define( 'FILES_CLIENT_SITE_ID', 'localdev' ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when/where is this being created that it is necessary to delete this at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakewrfoster I guess as part of the repo we have
vip-config/vip-config.php
that needs to be removed?