Update app environment file with backend endpoint.
484549
def update_api_endpoint():
    """"""
    environment = subprocess.check_output(['pipenv',
                                           'run',
                                           'runway',
                                           'whichenv']).decode().strip()
    environment_file = os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        'src',
        'environments',
        'environment.prod.ts' if environment == 'prod' else 'environment.ts'
    )
    cloudformation = boto3.resource('cloudformation')
    stack = cloudformation.Stack(STACK_PREFIX + environment)
    endpoint = [i['OutputValue'] for i in stack.outputs
                if i['OutputKey'] == 'ServiceEndpoint'][0]

    with open(environment_file, 'r') as stream:
        content = stream.read()
    content = re.sub(r'api_url: \'.*\'$',
                     "api_url: '%s/api'" % endpoint,
                     content,
                     flags=re.M)
    with open(environment_file, 'w') as stream:
        stream.write(content)
438468
def add(app, url = None, path = None, endpoint=None, decorate=None, index='index.html', **options):
    """"""

    url = url or app.static_url_path or ''
    path = os.path.abspath(path or app.static_folder or '.')
    endpoint = endpoint or 'static_' + os.path.basename(path)
    decorate = decorate or (lambda f: f)
    endpoints = {}

    if path == app.static_folder:
        raise ValueError('Files in `{}` path are already automatically served on `{}` URL by Flask.'
            ' Set Flask app static_folder to None, if you want to serve them using Flask Ecstatic at `{}` URL'
            .format(path, app.static_url_path, url))

    @app.route(url + '/<path:filename>', endpoint = endpoint)
    @handle404
    @decorate
    def static_files(filename):
        if index:
            filename = safe_join(path, filename)
            if os.path.isdir(filename):
                filename = os.path.join(filename, index)
            return send_file(filename, **options)
        else:
            return send_from_directory(path, filename, **options)

    endpoints[endpoint] = static_files

    if index:
         @app.route(url + '/', endpoint = endpoint + '_index')
         @handle404
         @decorate
         def static_index():
             return send_from_directory(path, index, **options)

         endpoints[endpoint + '_index'] = static_index

         if url:
             @app.route(url, endpoint = endpoint + '_index_bare')
             @handle404
             @decorate
             def static_index_bare():
                 return send_from_directory(path, index, **options)

             endpoints[endpoint + '_index_bare'] = static_index_bare

    return endpoints
249996
def update_endpoint_group(self, endpoint_group, body=None):
        """"""
        return self.put(self.endpoint_group_path % endpoint_group, body=body)
319920
def setup_app(command, conf, vars):
    """"""
    load_environment(conf.global_conf, conf.local_conf)
    setup_schema(command, conf, vars)
    bootstrap.bootstrap(command, conf, vars)
430615
def update_from_env(yaml_dict, prefix=None):
    '''
    
    '''
    prefix = prefix or ""

    def _set_env_var(path, node):
        env_path = "{0}{1}{2}".format(
            prefix.upper(),
            '_' if prefix else '',
            '_'.join([str(key).upper() for key in path])
        )
        env_val = os.environ.get(env_path, None)
        if env_val is not None:
            # convert the value to a YAML-defined type
            env_dict = yamldict.load('val: {0}'.format(env_val))
            return env_dict.val
        else:
            return None

    # traverse yaml_dict with the callback function
    yaml_dict.traverse(_set_env_var)
1256021
def __updatable():
    
    # Add argument for console
    parser = argparse.ArgumentParser()
    parser.add_argument('file', nargs='?', type=argparse.FileType(), default=None, help='Requirements file')
    args = parser.parse_args()

    # Get list of packages
    if args.file:
        packages = parse_requirements_list(args.file)
    else:
        packages = get_parsed_environment_package_list()

    # Output updates
    for package in packages:
        __list_package_updates(package['package'], package['version'])
582514
def update_config(updated_project):
    '''
    

    '''

    home = os.path.expanduser('~')
    if os.path.isfile(os.path.join(home, '.transfer', 'config.yaml')):
        with open(os.path.join(home, '.transfer', 'config.yaml'), 'r') as fp:
            projects = yaml.load(fp.read())
        replace_index = -1
        for i, project in enumerate(projects):
            if project['name'] == updated_project['name']:
                replace_index = i

        if replace_index > -1:
            projects[replace_index] = updated_project
            store_config(projects)
        else:
            print('Not saving configuration')
            print(colored('Project: ' + updated_project['name'] + ' was not found in configured projects!', 'red'))

    else:
        print('Transfer is not configured.')
        print('Please run:')
        print('')
        print(colored('    transfer --configure', 'cyan'))
        return
1297160
private function setEnvironment($app_token)
    {
        // by default, send all requests to the production API
        $this->setBaseAPIEndpoint(self::API_PRODUCTION_ENDPOINT);

        if(strpos(strtolower($app_token), 'test') !== false) {
            $this->setBaseAPIEndpoint(self::API_SANDBOX_ENDPOINT);
        }
    }
1012050
def update_options env, options
        if options[:method] and (ALLOWED_METHODS | ALLOWED_METHODS_PRIVATE).include?(options[:method])
          # (possibly) TODO - pass parameters for GET instead of POST in update_params then?
          # see https://github.com/rack/rack/blob/master/lib/rack/request.rb -> def GET
          env[METHOD] = options[:method]
        end
      end
314349
function (opts) {
	this.env = opts.env;
	this.app = opts.app;
	this.jsonP = opts.jsonP;
	_(this).bindAll('errResponse', 'printError', 'productionLogging', 'devLogging', 'log');
}
878888
def dev():
    """"""
    env.roledefs = {
        'web': ['192.168.1.2'],
        'lb': ['192.168.1.2'],
    }
    env.user = 'vagrant'
    env.backends = env.roledefs['web']
    env.server_name = 'django_search_model-dev.net'
    env.short_server_name = 'django_search_model-dev'
    env.static_folder = '/site_media/'
    env.server_ip = '192.168.1.2'
    env.no_shared_sessions = False
    env.server_ssl_on = False
    env.goal = 'dev'
    env.socket_port = '8001'
    env.map_settings = {}
    execute(build_env)
1081740
def add_environment_information(meta):
        """"""
        meta["timestamp"] = datetime.utcnow().isoformat(" ")
        meta["platform"] = platform.system()
        meta["release"] = platform.release()
        meta["python"] = platform.python_version()
        meta["packages"] = get_pkg_info("memote")
599716
def cli(env):
    """"""

    username, secret, endpoint_url, timeout = get_user_input(env)
    new_client = SoftLayer.Client(username=username, api_key=secret, endpoint_url=endpoint_url, timeout=timeout)
    api_key = get_api_key(new_client, username, secret)

    path = '~/.softlayer'
    if env.config_file:
        path = env.config_file
    config_path = os.path.expanduser(path)

    env.out(env.fmt(config.config_table({'username': username,
                                         'api_key': api_key,
                                         'endpoint_url': endpoint_url,
                                         'timeout': timeout})))

    if not formatting.confirm('Are you sure you want to write settings '
                              'to "%s"?' % config_path, default=True):
        raise exceptions.CLIAbort('Aborted.')

    # Persist the config file. Read the target config file in before
    # setting the values to avoid clobbering settings
    parsed_config = utils.configparser.RawConfigParser()
    parsed_config.read(config_path)
    try:
        parsed_config.add_section('softlayer')
    except utils.configparser.DuplicateSectionError:
        pass

    parsed_config.set('softlayer', 'username', username)
    parsed_config.set('softlayer', 'api_key', api_key)
    parsed_config.set('softlayer', 'endpoint_url', endpoint_url)
    parsed_config.set('softlayer', 'timeout', timeout)

    config_fd = os.fdopen(os.open(config_path,
                                  (os.O_WRONLY | os.O_CREAT | os.O_TRUNC),
                                  0o600),
                          'w')
    try:
        parsed_config.write(config_fd)
    finally:
        config_fd.close()

    env.fout("Configuration Updated Successfully")
366623
def update(ctx):
    
    ctx.obj['view'].updating_projects_database()

    projects = []

    for backend_name, backend_uri in ctx.obj['settings'].get_backends():
        backend = plugins_registry.get_backend(backend_name)
        backend_projects = backend.get_projects()

        for project in backend_projects:
            project.backend = backend_name

        projects += backend_projects

    ctx.obj['projects_db'].update(projects)

    # Put the shared aliases in the config file
    shared_aliases = {}
    backends_to_clear = set()
    for project in projects:
        for alias, activity_id in six.iteritems(project.aliases):
            mapping = Mapping(mapping=(project.id, activity_id),
                              backend=project.backend)
            shared_aliases[alias] = mapping
            backends_to_clear.add(project.backend)

    for backend in backends_to_clear:
        ctx.obj['settings'].clear_shared_aliases(backend)

    # The user can have local aliases with additional information (eg. role definition). If these aliases also exist on
    # the remote, then they probably need to be cleared out locally to make sure they don't unintentionally use an
    # alias with a wrong role
    current_aliases = ctx.obj['settings'].get_aliases()
    removed_aliases = [
        (alias, mapping)
        for alias, mapping in current_aliases.items()
        if (alias in shared_aliases and shared_aliases[alias].backend == mapping.backend
            and mapping.mapping[:2] != shared_aliases[alias].mapping[:2])
    ]

    if removed_aliases:
        ctx.obj['settings'].remove_aliases(removed_aliases)

    for alias, mapping in shared_aliases.items():
        ctx.obj['settings'].add_shared_alias(alias, mapping)

    aliases_after_update = ctx.obj['settings'].get_aliases()

    ctx.obj['settings'].write_config()

    ctx.obj['view'].projects_database_update_success(
        aliases_after_update, ctx.obj['projects_db']
    )
774663
def call_env_updated(cls, kb_app,
                         sphinx_app: Sphinx,
                         sphinx_env: BuildEnvironment):

        
        for callback in EventAction.get_callbacks(kb_app, SphinxEvent.EU):
            callback(kb_app, sphinx_app, sphinx_env)
1091734
def add_env(parser):
    """"""
    parser.add_argument(
        '-e', '--env', choices=ENVS, default=os.getenv('ENV', default='dev'), help='Deploy environment, overrides $ENV')
912989
def update(custom_sources=False):
    """"""
    if not shutil.which('git'):
        print('Git executable not found in $PATH.')
        sys.exit(1)

    if not custom_sources:
        print('Creating sources.yaml…')
        write_sources_file()
        print('Cloning sources…')
        sources_file = rel_to_cwd('sources.yaml')
        jobs = yaml_to_job_list(sources_file, rel_to_cwd('sources'))
        git_clone_job_list(jobs)

    print('Cloning templates…')
    jobs = yaml_to_job_list(rel_to_cwd('sources', 'templates', 'list.yaml'),
                            rel_to_cwd('templates'))
    print('Cloning schemes…')
    jobs.extend(yaml_to_job_list(rel_to_cwd('sources', 'schemes', 'list.yaml'),
                                 rel_to_cwd('schemes')))
    git_clone_job_list(jobs)
    print('Completed updating repositories.')