protected function createEnv($projectRoot, $docRoot, $address, array $appConfig)
    {
        $realDocRoot = realpath($docRoot);
        $envPrefix = $this->config()->get('service.env_prefix');
        $env = [
            '_PLATFORM_VARIABLES_PREFIX' => $envPrefix,
            $envPrefix . 'ENVIRONMENT' => '_local',
            $envPrefix . 'APPLICATION' => base64_encode(json_encode($appConfig)),
            $envPrefix . 'APPLICATION_NAME' => isset($appConfig['name']) ? $appConfig['name'] : '',
            $envPrefix . 'DOCUMENT_ROOT' => $realDocRoot,
            $envPrefix . 'ROUTES' => base64_encode(json_encode($this->getRoutesList($projectRoot, $address))),
        ];

        list($env['IP'], $env['PORT']) = explode(':', $address);

        if (dirname($realDocRoot, 2) === $projectRoot . '/' . $this->config()->get('local.build_dir')) {
            $env[$envPrefix . 'APP_DIR'] = dirname($realDocRoot);
        }

        if ($projectRoot === $this->getProjectRoot()) {
            try {
                $project = $this->getCurrentProject();
                if ($project) {
                    $env[$envPrefix . 'PROJECT'] = $project->id;
                }
            } catch (\Exception $e) {
                // Ignore errors
            }
        }

        return $env;
    }