How to use ember-get-config - 10 common examples

To help you get started, we’ve selected a few ember-get-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 CenterForOpenScience / ember-osf-web / tests / test-helper.ts View on Github external
import { setApplication } from '@ember/test-helpers';
import preloadAssets from 'ember-asset-loader/test-support/preload-assets';
import config from 'ember-get-config';
import Application from 'ember-osf-web/app';
import manifest from 'ember-osf-web/config/asset-manifest';
import { start } from 'ember-qunit';
import 'qunit-dom';

setApplication(Application.create(config.APP) as any);

(async () => {
    // This ensures all engine resources are loaded before the tests
    await preloadAssets(manifest);

    start();
})();
github CenterForOpenScience / ember-osf-web / tests / test-helper.ts View on Github external
import { setApplication } from '@ember/test-helpers';
import preloadAssets from 'ember-asset-loader/test-support/preload-assets';
import config from 'ember-get-config';
import Application from 'ember-osf-web/app';
import manifest from 'ember-osf-web/config/asset-manifest';
import { start } from 'ember-qunit';

setApplication(Application.create(config.APP) as any);

(async () => {
    // Remove /ember_osf_web prefix from manifest URIs.
    Object.values(manifest.bundles).forEach(bundle => {
        for (const asset of bundle.assets) {
            asset.uri = asset.uri.replace(/^\/ember_osf_web/, '');
        }
    });

    // This ensures all engine resources are loaded before the tests
    await preloadAssets(manifest);

    start();
})();
github CenterForOpenScience / ember-osf-web / app / components / new-navbar-auth-dropdown / component.js View on Github external
/**
     * The URL to use for signup. May be overridden, eg for special campaign pages
     *
     * @property signupUrl
     * @type {String}
     */
    signupUrl: `${config.OSF.url}register`,

    serviceLinks,
    gravatarUrl: Ember.computed('user', function() {
        const imgLink = this.get('user.links.profile_image');

        return imgLink ? `${imgLink}&s=25` : '';
    }),
    host: config.OSF.url,
    user: null,
    _loadCurrentUser() {
        this.get('currentUser')
            .load()
            .then(user => this.set('user', user));
    },
    init() {
        this._super(...arguments);
        // TODO: React to changes in service/ event?
        if (this.get('session.isAuthenticated')) {
            this._loadCurrentUser();
        }
    },
    // TODO: These parameters are defined in osf settings.py; make sure ember config matches.
    allowLogin: true,
    enableInstitutions: true,
github CenterForOpenScience / ember-osf-preprints / app / controllers / discover.js View on Github external
return this.get('activeFilters.subjects').slice();
    }),
    // chosenOption is always the first element in the list
    chosenSortByOption: Ember.computed('sortByOptions', function() {
        return this.get('sortByOptions')[0];
    }),

    showActiveFilters: true, //should always have a provider, don't want to mix osfProviders and non-osf
    showPrev: Ember.computed.gt('page', 1),
    showNext: Ember.computed('page', 'size', 'numberOfResults', function() {
        return this.get('page') * this.get('size') < this.get('numberOfResults');
    }),

    results: Ember.ArrayProxy.create({ content: [] }),

    searchUrl: config.SHARE.searchUrl,

    init() {
        this._super(...arguments);
        this.set('facetFilters', Ember.Object.create());

        Ember.$.ajax({
            type: 'POST',
            url: this.get('searchUrl'),
            data: getProvidersPayload,
            contentType: 'application/json',
            crossDomain: true,
        }).then(results => {
            const hits = results.aggregations.sources.buckets;
            const whiteList = this.get('whiteListedProviders');
            const providers = hits
                .filter(hit => whiteList.includes(hit.key));
github davidpett / ember-data-contentful / addon / adapters / contentful.js View on Github external
_getConfig() {
    let accessToken = config.contentful ? config.contentful.accessToken : config.contentfulAccessToken;
    let api = 'cdn';
    let space = config.contentful ? config.contentful.space : config.contentfulSpace;
    let previewAccessToken = config.contentful ? config.contentful.previewAccessToken : config.contentfulPreviewAccessToken;

    if (config.contentful.usePreviewApi || config.contentfulUsePreviewApi) {
      if (!previewAccessToken) {
        console.warn('You have specified to use the Contentful Preview API; However, no `previewAccessToken` has been specified in config/environment.js'); /* eslint-disable-line no-console */
      } else {
        accessToken = previewAccessToken;
        api = 'preview';
      }
    }
    if (config.contentfulAccessToken || config.contentfulSpace) {
      /* eslint-disable-next-line no-console */
      console.warn(`DEPRECATION: Use of 'contentfulAccessToken' and 'contentfulSpace' will be removed in ember-data-contentful@1.0.0. please migrate to the contentful object syntax:
      contentful: {
github davidpett / ember-data-contentful / addon / adapters / contentful.js View on Github external
_getConfig() {
    let accessToken = config.contentful ? config.contentful.accessToken : config.contentfulAccessToken;
    let api = 'cdn';
    let space = config.contentful ? config.contentful.space : config.contentfulSpace;
    let previewAccessToken = config.contentful ? config.contentful.previewAccessToken : config.contentfulPreviewAccessToken;

    if (config.contentful.usePreviewApi || config.contentfulUsePreviewApi) {
      if (!previewAccessToken) {
        console.warn('You have specified to use the Contentful Preview API; However, no `previewAccessToken` has been specified in config/environment.js'); /* eslint-disable-line no-console */
      } else {
        accessToken = previewAccessToken;
        api = 'preview';
      }
    }
    if (config.contentfulAccessToken || config.contentfulSpace) {
      /* eslint-disable-next-line no-console */
      console.warn(`DEPRECATION: Use of 'contentfulAccessToken' and 'contentfulSpace' will be removed in ember-data-contentful@1.0.0. please migrate to the contentful object syntax:
      contentful: {
        accessToken: '${accessToken}',
        space: '${space}'
github davidpett / ember-data-contentful / addon / adapters / contentful.js View on Github external
_getConfig() {
    let accessToken = config.contentful ? config.contentful.accessToken : config.contentfulAccessToken;
    let api = 'cdn';
    let space = config.contentful ? config.contentful.space : config.contentfulSpace;
    let previewAccessToken = config.contentful ? config.contentful.previewAccessToken : config.contentfulPreviewAccessToken;

    if (config.contentful.usePreviewApi || config.contentfulUsePreviewApi) {
      if (!previewAccessToken) {
        console.warn('You have specified to use the Contentful Preview API; However, no `previewAccessToken` has been specified in config/environment.js'); /* eslint-disable-line no-console */
      } else {
        accessToken = previewAccessToken;
        api = 'preview';
      }
    }
    if (config.contentfulAccessToken || config.contentfulSpace) {
      /* eslint-disable-next-line no-console */
      console.warn(`DEPRECATION: Use of 'contentfulAccessToken' and 'contentfulSpace' will be removed in ember-data-contentful@1.0.0. please migrate to the contentful object syntax:
      contentful: {
        accessToken: '${accessToken}',
        space: '${space}'
      }`);
    }
    return {
      accessToken,
      api,
      space
    };
  }
});
github CenterForOpenScience / ember-osf / addon / adapters / osf-adapter.js View on Github external
/*
  Base adapter class for all OSF APIv2 endpoints
 */
import Ember from 'ember';
import DS from 'ember-data';

import HasManyQuery from 'ember-data-has-many-query';
import config from 'ember-get-config';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';

export default DS.JSONAPIAdapter.extend(HasManyQuery.RESTAdapterMixin, DataAdapterMixin, {
    authorizer: 'authorizer:osf-token',
    host: config.OSF.apiUrl,
    namespace: config.OSF.apiNamespace,
    buildURL(modelName, id, snapshot, requestType) {
        // Fix issue where CORS request failed on 301s: Ember does not seem to append trailing
        // slash to URLs for single documents, but DRF redirects to force a trailing slash
        var url = this._super(...arguments);
        if (requestType === 'deleteRecord' || requestType === 'updateRecord' || requestType === 'findRecord') {
            if (snapshot.record.get('links.self')) {
                url = snapshot.record.get('links.self');
            }
        }
        if (url.lastIndexOf('/') !== url.length - 1) {
            url += '/';
        }
        return url;
    },
    /**
github CenterForOpenScience / ember-osf-web / app / components / new-osf-navbar / component.js View on Github external
*
 * Sample usage:
 * ```handlebars
 * {{osf-navbar
 *   loginAction=loginAction
 * }}
 * ```
 *
 * @class osf-navbar
 */
export default Ember.Component.extend(hostAppName, AnalyticsMixin, {
    layout,
    osfServices,
    session: Ember.inject.service(),
    serviceLinks,
    host: config.OSF.url,
    currentService: Ember.computed('hostAppName', function() { // Pulls current service name from consuming service's config file
        let appName = this.get('hostAppName') || 'Home';
        if (appName === 'Dummy App') {
            appName = 'Home';
        }
        return appName.toUpperCase();
    }),
    currentServiceLink: Ember.computed('serviceLinks', 'currentService', function() {
        const serviceMapping = {
            HOME: 'osfHome',
            PREPRINTS: 'preprintsHome',
            REGISTRIES: 'registriesHome',
            MEETINGS: 'meetingsHome',
        };
        const service = this.get('currentService');
        return this.get('serviceLinks')[serviceMapping[service]];
github CenterForOpenScience / ember-osf-web / app / services / meta-tags.ts View on Github external
getMetaTags(this: MetaTags, metaTagsOverrides: MetaTagsData): MetaTagsDefs {
        // Default values.
        const metaTagsData: MetaTagsData = {
            type: 'article',
            description: this.get('i18n').t('general.hosted_on_the_osf'),
            url: pathJoin(config.OSF.url, this.get('router').get('currentURL')),
            language: this.get('i18n').get('locale'),
            image: pathJoin(config.OSF.url, 'static/img/preprints_assets/osf/sharing.png'),
            imageType: 'image/png',
            imageWidth: 1200,
            imageHeight: 630,
            imageAlt: this.get('i18n').t('home.brand'),
            siteName: this.get('i18n').t('home.brand'),
            institution: this.get('i18n').t('general.cos'),
            fbAppId: config.FB_APP_ID,
            twitterSite: config.social.twitter.viaHandle,
            twitterCreator: config.social.twitter.viaHandle,
            ...metaTagsOverrides,
        };

        // Include URL, DOI, and any additional identifiers.
        const identifiers = toArray(metaTagsData.url)