首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Ember.JS中,如何安全地加载敏感环境数据?

在Ember.JS中,如何安全地加载敏感环境数据?
EN

Stack Overflow用户
提问于 2016-08-16 13:37:25
回答 1查看 43关注 0票数 0

/config/environment.js

代码语言:javascript
复制
/* jshint node: true */

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'bumbox',
    podModulePrefix: 'bumbox/pods',
    environment: environment,
    baseURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };

  if (environment === 'development') {
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.baseURL = '/';
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';
  }

  ENV['ember-simple-auth'] = {
    authenticationRoute: 'index',
    routeAfterAuthentication: 'protected',
    routeIfAlreadyAuthenticated: 'protected'
  };

  return ENV;
};

我有一些属性需要添加到ENV对象中,但我宁愿将这些属性存储在一个单独的.gitignore'd文件中,这样我就不会将它们发布到github上,比如/config/protected.js

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-16 13:55:58

https://github.com/fivetanley/ember-cli-dotenv项目就是您正在寻找的项目。

甚至有一段关于如何设置和使用ember的视频也会播放使用ember-cli-dotenv -cli-dotenv的视频

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38967309

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档