How to use mwp-config - 10 common examples

To help you get started, we’ve selected a few mwp-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 meetup / meetup-web-platform / packages / mwp-core / src / util / cookieUtils.js View on Github external
import querystring from 'qs';
import config from 'mwp-config';
const appConfig = config.getServer().properties;

export const MEMBER_COOKIE = appConfig.api.isProd
	? 'MEETUP_MEMBER'
	: 'MEETUP_MEMBER_DEV';

export const BROWSER_ID_COOKIE = appConfig.api.isProd
	? 'MEETUP_BROWSER_ID'
	: 'MEETUP_BROWSER_ID_DEV';

// SIFT_SESSION_ID cookie created in fastly and used by sift science to correlate spammy
// behavior to user activity; cookie has an expiration time of 4 hours and should be
// reset on logout. For more details please refer  https://sift.com/resources/tutorials/anonymous-users
export const SIFT_SESSION_COOKIE = appConfig.api.isProd
	? 'SIFT_SESSION_ID'
	: 'SIFT_SESSION_ID_DEV';
github meetup / meetup-web-platform / packages / mwp-app-server / src / index.js View on Github external
import './util/globals';

import fs from 'fs';
import Http2 from 'spdy'; // eventually this will be a native node module

import config from 'mwp-config';

import getRoutes from './routes';
import getPlugins from './util/getPlugins';
import { configureEnv, server } from './util';

const appConfig = config.getServer().properties;

/**
 * @module server
 */

/**
 * The start function applies the rendering function to the correct application
 * route and combines the provided routes and plugins with the base routes
 * and plugins
 *
 * @param {Object} languageRenderers A mapping of localeCodes to functions that emit
 *   the rendered HTML for the locale-specific request
 * @param {Array} routes additional routes for the app - cannot include a
 *   wildcard route
 * @param {Array} plugins additional plugins for the server, usually to support
 *   features in the additional routes
github meetup / meetup-web-platform / packages / mwp-api-proxy-plugin / src / util / send.js View on Github external
export function parseRequestHeaders(request) {
	const externalRequestHeaders = {
		...request.headers,
		...getAuthHeaders(request),
		...getClientIpHeader(request),
		...getTrackingHeaders(request),
		'accept-language': getLanguageHeader(request),
		'x-meetup-agent': config.package.agent,
		'x-meetup-parent-request-id': request.id,
	};

	delete externalRequestHeaders['host']; // let app server set 'host'
	delete externalRequestHeaders['accept-encoding']; // let app server set 'accept'
	delete externalRequestHeaders['content-length']; // original request content-length is irrelevant
	delete externalRequestHeaders['content-type']; // the content type will be set in buildRequestArgs

	return externalRequestHeaders;
}
github meetup / meetup-web-platform / packages / mwp-api-proxy-plugin / src / util / send.js View on Github external
export function parseRequestHeaders(request) {
	const externalRequestHeaders = {
		...request.headers,
		...getAuthHeaders(request),
		...getClientIpHeader(request),
		...getTrackingHeaders(request),
		'accept-language': getLanguageHeader(request),
		'x-meetup-agent': config.package.agent,
		'x-meetup-parent-request-id': request.id,
	};

	delete externalRequestHeaders['host']; // let app server set 'host'
	delete externalRequestHeaders['accept-encoding']; // let app server set 'accept'
	delete externalRequestHeaders['content-length']; // original request content-length is irrelevant
	delete externalRequestHeaders['content-type']; // the content type will be set in buildRequestArgs

	return externalRequestHeaders;
}
github meetup / meetup-web-platform / packages / mwp-sw-plugin / src / index.js View on Github external
// @flow
const buildPaths = require('mwp-config').paths;
const path = require('path');

/*
 * The service worker plugin will register a root-level route for serving the
 * service worker script file.
 *
 * Disk location of the script file is determined by builder CLI config import.
 */
export function register(server: Object, options: ?Object) {
	/*
	 * Route for service worker script at top-level path. Depends on `Inert`
	 * `path` must match client `serviceWorker.register` call - MWP provides this
	 * in the `` component
	 */
	server.route({
		method: 'GET',
github meetup / meetup-web-platform / packages / mwp-test-utils / src / mocks.js View on Github external
import csrf from 'electrode-csrf-jwt/lib/csrf';
import uuid from 'uuid';

import config from 'mwp-config';
import makeRenderer from 'mwp-core/lib/server-render';
const appConfig = config.getServer().properties;

import { clientFilename, routes, reducer } from 'mwp-test-utils/lib/mockApp';

export const getMockFetch = (mockResponseValue = { responses: [{}] }, headers = {}) =>
	Promise.resolve({
		text: () => Promise.resolve(JSON.stringify(mockResponseValue)),
		json: () => Promise.resolve(mockResponseValue),
		headers: {
			get: key => headers[key],
		},
	});

export function getCsrfHeaders() {
	const options = {
		secret: appConfig.csrf_secret,
	};
github meetup / meetup-web-platform / packages / mwp-api-proxy-plugin / src / config.js View on Github external
import { getServer } from 'mwp-config';

export const API_PROXY_PLUGIN_NAME = 'mwp-api-proxy-plugin';
export const API_ROUTE_PATH = getServer().properties.app_server.api_proxy_path;
github meetup / meetup-web-platform / packages / mwp-app-render / src / util / seo / links.js View on Github external
export const generateCanonicalUrlLinkTags = (baseUrl, localeCode, route) => {
	const localeLinks = locales.map(locale => (
		
	));

	return [
		...localeLinks,
		,
github meetup / meetup-web-platform / packages / mwp-app-render / src / util / seoHelper.jsx View on Github external
export const generateCanonicalUrlMetaTags = (baseUrl, localeCode, route) => {
	const localeLinks = locales.map(locale => (
		
	));

	return [
		...localeLinks,
		,
github meetup / meetup-web-platform / packages / mwp-sw-plugin / src / index.js View on Github external
handler: (request, h) => {
			const { localeCode } = request.params;
			const swPath = path.resolve(
				buildPaths.output.browser,
				localeCode,
				'asset-service-worker.js'
			);
			return h.file(swPath);
		},
	});

mwp-config

All the config you might ever need for a MWP app

MIT
Latest version published 2 years ago

Package Health Score

39 / 100
Full package analysis

Similar packages