How to use the config function in config

To help you get started, we’ve selected a few config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / client / login / wp-login / login-links.jsx View on Github external
renderSignUpLink() {
		// Taken from client/layout/masterbar/logged-out.jsx
		const { currentQuery, currentRoute, oauth2Client, pathname, translate, wccomFrom } = this.props;

		let signupUrl = config( 'signup_url' );
		const signupFlow = get( currentQuery, 'signup_flow' );
		if (
			// Match locales like `/log-in/jetpack/es`
			startsWith( currentRoute, '/log-in/jetpack' )
		) {
			// Basic validation that we're in a valid Jetpack Authorization flow
			if (
				includes( get( currentQuery, 'redirect_to' ), '/jetpack/connect/authorize' ) &&
				includes( get( currentQuery, 'redirect_to' ), '_wp_nonce' )
			) {
				/**
				 * `log-in/jetpack/:locale` is reached as part of the Jetpack connection flow. In
				 * this case, the redirect_to will handle signups as part of the flow. Use the
				 * `redirect_to` parameter directly for signup.
				 */
				signupUrl = currentQuery.redirect_to;
github Automattic / wp-calypso / client / lib / olark / index.js View on Github external
return new Promise( ( resolve, reject ) => {
			// TODO: Maybe store this configuration in local storage? The problem is that the configuration for a user could
			// change if they purchase upgrades or if their upgrades expire. There's also throttling that happens for unpaid users.
			// There is lots to consider before storing this configuration
			debug( 'Using rest api to get olark configuration' );
			const clientSlug = config( 'client_slug' );

			wpcomUndocumented.getOlarkConfiguration( clientSlug, ( error, configuration ) => {
				if ( error ) {
					reject( error );
					return;
				}
				resolve( configuration );
			} );
		} );
	},
github Automattic / wp-calypso / client / lib / url / is-external.ts View on Github external
return false;
	}

	if ( typeof window !== 'undefined' ) {
		if ( hostname === window.location.hostname ) {
			// even if hostname matches, the url might be outside calypso
			// outside calypso should be considered external
			// double separators are valid paths - but not handled correctly
			if ( pathname && isLegacyRoute( pathname.replace( '//', '/' ) ) ) {
				return true;
			}
			return false;
		}
	}

	return hostname !== config( 'hostname' );
}
github ecomfe / uioc / test / spec / integration.js View on Github external
    beforeEach(() => iocInstance = new IoC(config()));
github Automattic / wp-calypso / client / reader / discover / helper.js View on Github external
export function isDiscoverPost( post ) {
	return !! (
		get( post, 'discover_metadata' ) || get( post, 'site_ID' ) === config( 'discover_blog_id' )
	);
}
github Automattic / delphin / app / lib / analytics / index.js View on Github external
recordEvent( eventName, eventValue = null ) {
			if ( ! isEnabled( 'atlas' ) ) {
				return;
			}

			const params = Object.assign( {}, eventValue, {
				event: eventName
			} );

			const urlParams = Object.keys( params ).map( function( key ) {
				return encodeURIComponent( key ) + '=' + encodeURIComponent( params[ key ] );
			} ).join( '&' );

			loadScript( `https://ad.atdmt.com/m/a.js;m=${ config( 'atlas_tag_id' ) };cache=${ Math.random() }?${ urlParams }` );
		},
github Automattic / wp-calypso / server / pages / index.js View on Github external
app.get( '/discover', function( req, res, next ) {
			if ( ! req.context.isLoggedIn ) {
				res.redirect( config( 'discover_logged_out_redirect_url' ) );
			} else {
				next();
			}
		} );
github Automattic / wp-calypso / server / api / sign-in-with-apple.js View on Github external
function loginEndpointData() {
	return {
		client_id: config( 'wpcom_signup_id' ),
		client_secret: config( 'wpcom_signup_key' ),
		service: 'apple',
		signup_flow_name: 'no-signup',
	};
}
github Automattic / wp-calypso / client / state / data-layer / wpcom / read / following / mine / new / index.js View on Github external
export function requestFollow( action ) {
	const feedUrl = get( action, 'payload.feedUrl' );

	return http(
		{
			method: 'POST',
			path: '/read/following/mine/new',
			apiVersion: '1.1',
			body: {
				url: feedUrl,
				source: config( 'readerFollowingSource' ),
			},
		},
		action
	);
}
github Automattic / wp-calypso / client / my-sites / plugins / utils.js View on Github external
export function getExtensionSettingsPath( plugin ) {
	const pluginSlug = get( plugin, 'slug', '' );
	const sections = getSections();
	const section = find( sections, value => value.name === pluginSlug );
	const env = get( section, 'envId', [] );

	if ( ! includes( env, config( 'env_id' ) ) ) {
		return;
	}

	return get( section, 'settings_path' );
}