Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
bac38662
Commit
bac38662
authored
Sep 22, 2017
by
John Elliott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional install script to prompt for APP_URL when populating .env file
parent
a8f63696
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
0 deletions
+97
-0
InstallCommand.php
Modules/Core/Console/InstallCommand.php
+1
-0
ConfigureAppUrl.php
Modules/Core/Console/Installers/Scripts/ConfigureAppUrl.php
+96
-0
No files found.
Modules/Core/Console/InstallCommand.php
View file @
bac38662
...
...
@@ -59,6 +59,7 @@ class InstallCommand extends Command
\Modules\Core\Console\Installers\Scripts\ProtectInstaller
::
class
,
\Modules\Core\Console\Installers\Scripts\CreateEnvFile
::
class
,
\Modules\Core\Console\Installers\Scripts\ConfigureDatabase
::
class
,
\Modules\Core\Console\Installers\Scripts\ConfigureAppUrl
::
class
,
\Modules\Core\Console\Installers\Scripts\SetAppKey
::
class
,
\Modules\Core\Console\Installers\Scripts\ConfigureUserProvider
::
class
,
\Modules\Core\Console\Installers\Scripts\ModuleMigrator
::
class
,
...
...
Modules/Core/Console/Installers/Scripts/ConfigureAppUrl.php
0 → 100644
View file @
bac38662
<?php
namespace
Modules\Core\Console\Installers\Scripts
;
use
Illuminate\Console\Command
;
use
Illuminate\Contracts\Config\Repository
as
Config
;
use
Modules\Core\Console\Installers\SetupScript
;
use
Modules\Core\Console\Installers\Writers\EnvFileWriter
;
class
ConfigureAppUrl
implements
SetupScript
{
/**
* @var
*/
protected
$config
;
/**
* @var EnvFileWriter
*/
protected
$env
;
/**
* @param Config $config
* @param EnvFileWriter $env
*/
public
function
__construct
(
Config
$config
,
EnvFileWriter
$env
)
{
$this
->
config
=
$config
;
$this
->
env
=
$env
;
}
/**
* @var Command
*/
protected
$command
;
/**
* Fire the install script
* @param Command $command
* @return mixed
*/
public
function
fire
(
Command
$command
)
{
$this
->
command
=
$command
;
$vars
=
[];
$vars
[
'app_url'
]
=
$this
->
askAppUrl
();
$this
->
setLaravelConfiguration
(
$vars
);
$this
->
env
->
write
(
$vars
);
$command
->
info
(
'Application url successfully configured'
);
}
/**
* Ensure that the APP_URL is valid
*
* e.g. http://localhost, http://192.168.0.10, https://www.example.com etc.
*
* @return string
*/
protected
function
askAppUrl
()
{
do
{
$str
=
$this
->
command
->
ask
(
'Enter you application url (e.g. http://localhost, http://dev.example.com)'
,
'http://localhost'
);
if
(
$str
==
''
||
(
strpos
(
$str
,
'http://'
)
!==
0
&&
strpos
(
$str
,
'https://'
)
!==
0
))
{
$this
->
command
->
error
(
'A valid http:// or https:// url is required'
);
$str
=
false
;
}
}
while
(
!
$str
);
return
$str
;
}
/**
* @param $vars
*/
protected
function
setLaravelConfiguration
(
$vars
)
{
$this
->
config
[
'app.url'
]
=
$vars
[
'app_url'
];
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment