Get env config

@param {string} bundle
@param {string} env

@return {Object} json conf
163859
function(bundle, env) {

            if ( !self.isStandalone ) {
                if ( !bundle && typeof(self.bundle) != 'undefined' ) {
                    var bundle = self.bundle
                }
                return ( typeof(self.envConf) != "undefined" ) ? self.envConf[bundle][env] : null;
            } else {

                if (!bundle) { // if getContext().bundle is lost .. eg.: worker context
                    var model       = (arguments.length == 1) ? bundle : model
                        , file      = ( !/node_modules/.test(__stack[1].getFileName()) ) ?  __stack[1].getFileName() : __stack[2].getFileName()
                        , a         = file.replace('.js', '').split('/')
                        , i         = a.length-1
                        , bundles   = getContext('gina').config.bundles
                        , index     = 0;

                    for (; i >= 0; --i) {
                        index = bundles.indexOf(a[i]);
                        if ( index > -1 ) {
                            bundle = bundles[index];
                            break
                        }
                    }
                }

                if ( typeof(self.envConf) != "undefined" ) {
                    self.envConf[bundle][env].hostname = self.envConf[self.startingApp][env].hostname;
                    self.envConf[bundle][env].content.routing = self.envConf[self.startingApp][env].content.routing;

                    if ( bundle && env ) {
                        return self.envConf[bundle][env]
                    } else if ( bundle && !env ) {
                        return self.envConf[bundle]
                    } else {
                        return self.envConf
                    }
                }

                return null
            }
        }
20914
function bundler(options) {
        var allFiles = {};
        var bundles = {};
        var dir = options.src;
        var dest = options.dest;
        var resourcesFile = options.resourceJson;
        var indexBundles = options.indexBundles;
        var titleIndexBnudles = {};
        var traversed_bundles = {}, traversed_files = {}, excluded_bundles = {};
        var resourcesJs = {};
        for (var key in options) {
            resourcesJs[key] = options[key];
        }
        resourcesJs.bundles = bundles;

        function getFiles(packageName, files, bundledFile, includedBundles) {
            if (!traversed_bundles[packageName] && !excluded_bundles[packageName]) {
                traversed_bundles[packageName] = true;
                var bundle = resourcesJs.bundles[packageName];
                if (bundle) {
                    bundle.bundled = bundle.bundled || [];
                    bundle.bundled_html = bundle.bundled_html || [];
                    bundle.in = bundle.in || [];
                    for (var i in bundle.on) {
                        files = getFiles(bundle.on[i], files, bundledFile, includedBundles);
                    }
                    for (var j in bundle.js) {
                        var _file2 = cleanURL(dir + "/" + bundle.js[j]);
                        if (!traversed_files[_file2]) {
                            files.js.push(_file2);
                            traversed_files[_file2] = packageName;
                        }
                    }
                    if (files.js.length > 0) {
                        bundle.bundled.push(bundledFile + ".js");
                    }

                    for (var i in bundle.html) {
                        var _file = cleanURL(dir + "/" + bundle.html[i]);
                        if (!traversed_files[_file]) {
                            files.html.push(_file);
                            traversed_files[_file] = packageName;
                        }
                    }
                    if (files.html.length > 0) {
                        bundle.bundled_html.push(bundledFile + ".html");
                    }

                    includedBundles.push(packageName);
                }
            }
            return files;
        }

        if (TASK_BUNDLIFY || TASK_SCAN) {
            grunt.file.recurse(dir, function(abspath, rootdir, subdir, filename) {
                if (filename === "module.json" && abspath.indexOf(dest) !== 0) {
                    var packageInfo = {};
                    if (grunt.file.exists(subdir + "/.bower.json")) {
                        var bowerJson = grunt.file.readJSON(subdir + "/.bower.json");
                        packageInfo.bowerName = bowerJson.name;
                        packageInfo.bowerVersion = bowerJson.version;
                    }
                    if (grunt.file.exists(subdir + "/composer.json")) {
                        var composerJson = grunt.file.readJSON(subdir + "/composer.json");
                        packageInfo.composerName = composerJson.name;
                        packageInfo.composerVersion = composerJson.version;
                    }
                    var _bundles = grunt.file.readJSON(abspath);
                    var packageName = _bundles.name;
                    if (_bundles.exclude) {
                        for (var i in _bundles.exclude) {
                            excluded_bundles[_bundles.exclude[i]] = true;
                        }
                    }
                    if (packageName !== undefined) {
                        titleIndexBnudles[packageName] = [];
                        for (var bundleName in _bundles) {
                            if ((bundleName === packageName || bundleName.indexOf(packageName + "/") === 0) && !excluded_bundles[bundleName]) {
                                if (bundles[bundleName]) {
                                    console.log("====Duplicate Package", bundleName);
                                } else if (!toIgnore(bundleName)) {
                                    titleIndexBnudles[packageName].push(bundleName);
                                }
                                bundles[bundleName] = { js: [], on: [], css: [], html: [], packageInfo: packageInfo};
                                for (var file_i in _bundles[bundleName].js) {
                                    var js_file = subdir + "/" + _bundles[bundleName].js[file_i];
                                    bundles[bundleName].js.push(js_file);
                                    if (!allFiles[js_file]) {
                                        allFiles[js_file] = js_file;
                                    } else {
                                        console.log("====Duplicate File" + js_file);
                                    }
                                }
                                for (var file_j in _bundles[bundleName].css) {
                                    var css_file = subdir + "/" + _bundles[bundleName].css[file_j];
                                    bundles[bundleName].css.push(css_file);
                                    if (!allFiles[css_file]) {
                                        allFiles[css_file] = css_file;
                                    } else {
                                        console.log("====Duplicate File" + css_file);
                                    }
                                }
                                for (var file_k in _bundles[bundleName].html) {
                                    var html_file = subdir + "/" + _bundles[bundleName].html[file_k];
                                    bundles[bundleName].html.push(html_file);
                                    if (!allFiles[html_file]) {
                                        allFiles[html_file] = html_file;
                                    } else {
                                        console.log("====Duplicate File" + html_file);
                                    }
                                }
                                bundles[bundleName].on = _bundles[bundleName].on || [];
                                console.log("╬═╬ Module.json", abspath);
                                //console.log(bundleName, _bundles[bundleName].on);
                            }
                        }
                    }
                }
            });


            var titleIndexBnudlesNames = Object.keys(titleIndexBnudles);

            if (options.modulize) {
                titleIndexBnudlesNames.map(function(bundName) {
                    if (!bundles[bundName] && !toIgnore(bundName)) {
                        bundles[bundName] = { js: [], on: titleIndexBnudles[bundName], css: [], html: [], packageInfo: {}};
                        console.log("New Package ", bundName, bundles[bundName]);
                    }
                });
            }

            for (var packageKey in excluded_bundles) {
                delete bundles[packageKey];
            }

            var firstIndexBundled = null;

            if (!TASK_SKIP_INIT) {
                var myIndexBnudles = indexBundles;
                if (TASK_BUNDLIFY) {

                    var moreBundles = Object.keys(bundles);

                    if (options.sort) {
                        moreBundles = moreBundles.sort();
                    }

                    if (options.projectPrefix !== undefined) {
                        myIndexBnudles = uniqueArray(myIndexBnudles.concat(titleIndexBnudlesNames.concat(moreBundles).filter(function(bundleName) {
                            return bundleName.indexOf(options.projectPrefix) === 0;
                        })));
                    }

                    myIndexBnudles = uniqueArray(myIndexBnudles.concat(titleIndexBnudlesNames.concat(moreBundles))).filter(function(bundleName) {
                        return !toIgnore(bundleName);
                    });

                }
                console.log("Bundles in Order", myIndexBnudles);

                var prevBundle = null;
                myIndexBnudles.forEach(function(bundleName) {
                    var _bundleMap = {};
                    var includedBundles = [];
                    var bundledFile = dest + "/bootloader_bundled/" + bundleName.split("/").join(".");
                    var bundledFile_js = bundledFile + ".js";
                    var files = getFiles(bundleName, {js: [], html: []}, bundledFile, includedBundles);
                    var js_files = uniqueArray(files.js.reverse()).reverse();
                    if (js_files.length > 0) {
                        if (!firstIndexBundled && options.resourcesInline) {
                            firstIndexBundled = bundleName;
                            js_files.unshift(resourcesFile + ".js");
                        }
                        _bundleMap[bundledFile_js] = js_files;
                        //console.log("files",bundleName,files.length,files);
                        setBundleConfig(bundleName, _bundleMap, includedBundles, bundledFile_js);

                        if (prevBundle && options.order) {
                            var bundle = resourcesJs.bundles[bundleName];
                            if (bundle) {
                                bundle.on = [prevBundle].concat(bundle.on);
                            }
                        }
                        prevBundle = bundleName;

                    } else console.log("╬═╬ No File in bundle to bundlify thus skipping ", bundleName);

                    var html_files = uniqueArray(files.html.reverse()).reverse();
                    if (html_files.length) {
                        var html_file_content = "";
                        for (var i in html_files) {
                            html_file_content += '<script type="text/html" src="' + html_files[i] + '">' + grunt.file.read(html_files[i]).split("\t").join("")
                                .split("\n").join(" ")
                                .split(">").map(function(v) {
                                    return v.trim();
                                }).join(">") + '</script>';
                        }
                        grunt.file.write(bundledFile + ".html", html_file_content);
                    }

                });

                resourcesJs.gitinfo = grunt.config().gitinfo;
                if (firstIndexBundled) {
                    var resJsonString = JSON.stringify({
                        RESOURCES_JSON: resourcesJs,
                        RESOURCES_FILE: resourcesFile
                    }).replace(/\r?\n|\r|\\n/g, ' ');

                    var packed = resJsonString;
                    var unpack = "";
                    if(options.jsonpack){
                        var jsonpack = require('jsonpack/main');
                        var fs = require("fs");
                        unpack = grunt.file.read('node_modules/jsonpack/main.js');
                        packed =('(jsonpack.unpack(\''+jsonpack.pack(resJsonString)+'\'))');
                    }

                    grunt.file.write(resourcesFile + ".js", unpack+";var _BOOTLOADER_CONFIG_=" + packed);
                    resourcesJs.bundles[firstIndexBundled].js.unshift(resourcesFile + ".js");
                }

                grunt.task.run("uglify");
            }

            grunt.file.write(resourcesFile, JSON.stringify(resourcesJs));

        }
    }
641082
function getConfig(api) {
	const conf = api.resolveChainableWebpackConfig()

	// because we are dealing with hot replacement in vsg
	// remove duplicate hot module reload plugin
	conf.plugins.delete('hmr')

	const eslintRule = conf.module.rule('eslint')
	if (eslintRule) {
		const path = require('path')
		const vsgPath = path.resolve(path.dirname(require.resolve('vue-styleguidist')), '../')
		eslintRule.exclude.add(vsgPath)
	}

	// remove the double compiled successfully message
	conf.plugins.delete('friendly-errors')
	return api.resolveWebpackConfig(conf)
}
1055424
function getSlateEnv() {
  const env = {};

  SLATE_ENV_VARS.forEach((key) => {
    env[key] = process.env[key];
  });

  return env;
}
777568
function getFiles(env)
{
  var files       = []
    , environment = env['NODE_ENV'] || this.defaults.environment
    , appInstance = env['NODE_APP_INSTANCE']
    ;

  // generate config files variations
  this.files.forEach(function(baseName)
  {
    // check for variables
    // keep baseName if no variables found
    baseName = parseTokens(baseName, env) || baseName;

    // add base name with available suffixes
    addWithSuffixes.call(this, files, baseName, appInstance);
    addWithSuffixes.call(this, files, baseName, environment, appInstance);
  }.bind(this));

  return files;
}
1334901
private static JSONObject toJSONObject(@Nonnull ResourceBundle bundle) {
        JSONObject json = new JSONObject();
        for (String key : bundle.keySet()) {
            json.put(key, bundle.getString(key));
        }
        return json;
    }
692462
function getBundlesPaths(configuration){
	// If a bundlesPath is not provided, the paths are not needed because they are
	// already set up in steal.js
	if(!configuration.loader.bundlesPath) {
		return "";
	}
	var bundlesPath = configuration.bundlesPathURL;

	// Get the dist directory and set the paths output
	var paths = util.format('\tSystem.paths["bundles/*.css"] ="%s/*css";\n' +
													'\tSystem.paths["bundles/*"] = "%s/*.js";\n',
													bundlesPath, bundlesPath);
	return "if(!System.bundlesPath) {\n" + paths + "}\n";
}
1156557
def default_bundle_config():
    """"""

    import os
    from ambry.util import AttrDict

    config = AttrDict()
    f = os.path.join(
        os.path.dirname(
            os.path.realpath(__file__)),
        'bundle.yaml')

    config.update_yaml(f)

    return config
1090286
function(opt, project, env, bundle) {

        if ( reserved.indexOf(bundle) > -1 ) {
            console.error('[ '+bundle+' ] is a reserved name. Please, try something else.');
            process.exit(1)
        }

        if ( !isValidName() ) {
            console.error('[ '+bundle+' ] is not a valid bundle name. Please, try something else: [a-Z0-9].');
            process.exit(1)
        }

        self.root = getPath('root');
        self.opt = opt;

        self.project = project;
        self.projectData = require(project);
        self.env = env;
        if ( !fs.existsSync(env) ) {
            fs.writeFileSync(env, '{}')
        }
        self.envData = require(env);

        self.bundle = bundle;
        console.debug('adding', bundle);

        try {
            check()
        } catch (err) {
            rollback(err)
        }
    }
1297211
async function bundle(opts: *) {
  const directory = process.cwd();
  const configPath = getWebpackConfig(directory, opts.config);

  const [
    configs,
    availablePlatforms,
  ] = makeReactQMLConfig(
    // $FlowFixMe: Dynamic require
    require(configPath),
    {
      root: directory,
      dev: opts.dev,
      minify: opts.minify,
      bundle: true,
    }
  );

  const config = configs[availablePlatforms.indexOf(opts.platform)];

  if (opts.assetsDest) {
    config.output.path = path.isAbsolute(opts.assetsDest)
      ? opts.assetsDest
      : path.join(directory, opts.assetsDest);
  }

  if (opts.bundleOutput) {
    config.output.filename = path.isAbsolute(opts.bundleOutput)
      ? path.relative(config.output.path, opts.bundleOutput)
      : path.relative(
          config.output.path,
          path.join(directory, opts.bundleOutput)
        );
  }

  const compiler = webpack(config);

  logger.info(
    messages.initialBundleInformation({
      entry: config.entry,
      dev: opts.dev,
    })
  );

  const stats = await new Promise((resolve, reject) =>
    compiler.run((err, info) => {
      if (err || info.hasErrors()) {
        reject(
          new MessageError(
            messages.bundleFailed({
              errors: err
                ? [err.message]
                : info.toJson({ errorDetails: true }).errors,
            })
          )
        );
      } else {
        resolve(info);
      }
    })
  );

  clear();

  logger.done(
    messages.bundleBuilt({
      stats,
      platform: opts.platform,
      assetsPath: config.output.path,
      bundlePath: config.output.filename,
    })
  );
}
519842
function getEnvironment (options) {
  var env;

  if (options.environment) {
    env = options.environment;
  } else {
    env = process.env.NODE_ENV;
  }

  if (env) {
    if (env === 'prod') {
      env = 'production';
    } else if (env === 'dev') {
      env = 'development';
    }
  } else {
        // Default to "development"
    env = 'development';
  }

  return env;
}
280928
function _getEnvUrl (currentEnv, config) {
  if (currentEnv && config) {
    if (currentEnv === 'prod') {
      return config.urls.prod
    } else if (currentEnv === 'ref') {
      return config.urls.ref
    } else {
      return config.urls.dev
    }
  }
}
1290790
def _settings_from_env(self):
        """"""
        return {attr: self._val_from_env(env, attr)
                for env, attr in const.ENV_TO_ATTR.items()
                if env in os.environ}
237062
public static function getAllPackagesResolver($env = 'dev', CoreConsole $console = null)
    {
        $console = $console ?: Ioc::getApplication();

        $container = clone $console->container;
        $container->share(EventDispatcher::class, $container->newInstance(EventDispatcher::class));

        $resolver = new PackageResolver($container);

        foreach (static::loadPackages($env, $console) as $name => $package) {
            $resolver->addPackage($name, $package);
        }

        return $resolver;
    }
565133
function bundle() {
  return browserify( config.inputDir + config.inputFile ).bundle()
    .pipe(
      source( config.outputFile )
    )
    .pipe(
      rename( config.outputFile )
    )
    .pipe(
      gulp.dest( config.outputDir ) // Create the .devel.js
    )
    .pipe(
      streamify( jsmin() )
    )
    .pipe(
      rename( config.outputFileMin )
    )
    .pipe(
      gulp.dest( config.outputDir ) // Create the .min.js
    )
    .pipe(
      streamify( gzip() )
    )
    .pipe(
      rename( config.outputFileMinGz )
    )
    .pipe(
      gulp.dest( config.outputDir ) // Create the .min.gz
    );
}
707045
function envVars(config) {
  const configuration = Object.assign({}, config);
  if (process.env.AMQP_URL && !configuration.host) {
    configuration.host = process.env.AMQP_URL;
  }

  if (process.env.LOCAL_QUEUE && !configuration.consumerSuffix) {
    configuration.consumerSuffix = process.env.LOCAL_QUEUE;
  }

  if (process.env.AMQP_DEBUG && !configuration.transport) {
    configuration.transport = console;
  }

  return configuration;
}
1358528
function _loadEnv(cwd) {
  const envPath = resolve(cwd, '.env');

  if (!process.env.SECRET_KEY && !fs.existsSync(envPath)) {
    Generator.copyEnv(cwd);
  }

  dotenv.config({ path: envPath });
}