Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
837f2cf
start core logic implementation
cggonzal Sep 21, 2025
b2f90dd
modify env example to have relevant deploy environment variables
cggonzal Sep 21, 2025
da70f58
modify environment variables and deployment options
cggonzal Sep 21, 2025
bdff5ff
refine server set up
cggonzal Sep 21, 2025
360e97a
comment changes
cggonzal Sep 21, 2025
fffc71b
bug fixes from audit
cggonzal Sep 21, 2025
ef5477f
add comment with documentation at the top of deploy command file
cggonzal Sep 21, 2025
438415a
update comment
cggonzal Sep 21, 2025
0eddab8
update tests
cggonzal Sep 22, 2025
7b719d7
rearrange comment usage to bottom
cggonzal Sep 22, 2025
65e0c3b
more comments tweaks
cggonzal Sep 22, 2025
a69e267
clean up created files during tests
cggonzal Sep 23, 2025
bdf45c5
add checks for runtime environment and scp, ssh, bash, dependencies
cggonzal Sep 23, 2025
b6746a8
test fixes
cggonzal Sep 23, 2025
ea9e7f2
windows tests bug fix
cggonzal Sep 23, 2025
6ab1db4
increase code coverage on tests
cggonzal Sep 23, 2025
f3a4b91
increase code coverage
cggonzal Sep 23, 2025
531f3eb
Revert "increase code coverage"
cggonzal Sep 23, 2025
5af9796
Revert "increase code coverage on tests"
cggonzal Sep 23, 2025
2f42405
add missing env variable to example
cggonzal Sep 24, 2025
9c17702
properly handle rollback based on deploy tests
cggonzal Sep 24, 2025
784980c
modify tests
cggonzal Sep 24, 2025
b5c52c7
address comments
cggonzal Sep 26, 2025
a59d682
remove domain nil check
cggonzal Sep 27, 2025
29053e7
use existing file existence check function
cggonzal Sep 27, 2025
53da0b5
added EnvString() and EnvBool() functions
cggonzal Sep 27, 2025
7e10767
introduce windows support
cggonzal Sep 27, 2025
3b3872a
increase test coverage for windows
cggonzal Sep 28, 2025
5049a0a
change DEPLOY_APP_PORT to DEPLOY_REVERSE_PROXY_PORT
cggonzal Sep 28, 2025
b821119
cahnge DEPLOY_IP_ADDRESS to DEPLOY_SSH_IP
cggonzal Sep 28, 2025
06a3129
remove deployment configuration from .env file and instead put in the…
cggonzal Sep 28, 2025
67ecb2d
make remote base directory a variable instead of forcing to /var/www
cggonzal Sep 28, 2025
0bf6226
stop mocking build command and just call it directly via CLI
cggonzal Sep 28, 2025
0e46296
handle encrypted env file
cggonzal Sep 28, 2025
8498bd6
change getAllOptions to getDeployOptions
cggonzal Sep 28, 2025
d14c874
change getWhichFilesToUpload() to getUploadOptions()
cggonzal Sep 28, 2025
a0c39c8
make setupServerCommand only take in 1 value
cggonzal Sep 28, 2025
75256d6
change parameters into commands so they are minimized
cggonzal Sep 28, 2025
0120621
mock config and mock context initialization
cggonzal Sep 28, 2025
f72a80b
add more deploy success and failure tests
cggonzal Sep 28, 2025
2009d15
put config keys inside of app.deploy.*** and app.build.***
cggonzal Oct 5, 2025
867645e
update tests
cggonzal Oct 5, 2025
eb82a46
zip backups and .prev safety
cggonzal Oct 5, 2025
9da7d81
only upload storage on initial setup
cggonzal Oct 5, 2025
dcdf326
add tests for new EnvString() and EnvBool() config functions
cggonzal Oct 5, 2025
b757797
update deploy command documentation comment
cggonzal Oct 5, 2025
5a5f37d
change ipAddress to sshIP and appPort to reverseProxyPort
cggonzal Oct 5, 2025
d5b3e2a
make rollback command take opts as the only parameter
cggonzal Oct 5, 2025
a0c7655
use artisan facade for build command
cggonzal Oct 5, 2025
dee98c7
use content to check if env file is encrypted
cggonzal Oct 5, 2025
1c9b17b
modify isServerAlreadySetup() to take in opts as the only parameter
cggonzal Oct 5, 2025
c3e7f00
remove os check
cggonzal Oct 5, 2025
98103e8
update wording for local host validation
cggonzal Oct 5, 2025
abe4d5a
modify test maybe checks
cggonzal Oct 5, 2025
34018a6
resolve lint error
cggonzal Oct 5, 2025
cfacc1d
add tests
cggonzal Oct 5, 2025
aac4ad1
update tests
cggonzal Oct 5, 2025
44ab652
fix lint error
cggonzal Oct 5, 2025
e3bdad0
fix failing CI
cggonzal Oct 5, 2025
ef23b28
sort deployOptions struct alphabetically
cggonzal Oct 26, 2025
f81516d
comment update
cggonzal Oct 26, 2025
87edad1
modify error handling in validLocalHost
cggonzal Oct 26, 2025
2dfbdf1
remove unused param
cggonzal Oct 26, 2025
da7fd22
modify getDeployOptions error handling to not exit
cggonzal Oct 26, 2025
d2d754f
add tests for isEncryptedEnvContent function
cggonzal Oct 26, 2025
b1a291a
support env decrypt deploys
cggonzal Oct 26, 2025
bc61a90
change force-setup flag to --force
cggonzal Oct 26, 2025
ab9fe0d
get APP_ENV from .env file instead of putting it into systemd environ…
cggonzal Oct 26, 2025
da6002c
have app prefer the http.port for the reverse proxy setting
cggonzal Oct 26, 2025
fc3d197
address force setup comments
cggonzal Oct 26, 2025
2b5e664
allow caddy to support tls off mode
cggonzal Oct 26, 2025
41b3454
Merge branch 'master' into feature/deploy-command-core-logic
cggonzal Oct 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ func (app *Application) Env(envName string, defaultValue ...any) any {
return value
}

// EnvString get string value from env with optional default.
func (app *Application) EnvString(envName string, defaultValue ...string) string {
value := app.Env(envName)
if cast.ToString(value) == "" {
return convert.Default(defaultValue...)
}
return cast.ToString(value)
}

// EnvBool get bool value from env with optional default.
func (app *Application) EnvBool(envName string, defaultValue ...bool) bool {
value := app.Env(envName)
// If no value and a default provided, return default
if cast.ToString(value) == "" && len(defaultValue) > 0 {
return defaultValue[0]
}
return cast.ToBool(value)
}

// Add config to application.
func (app *Application) Add(name string, configuration any) {
app.vip.Set(name, configuration)
Expand Down
36 changes: 36 additions & 0 deletions config/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,42 @@ func (s *ApplicationTestSuite) TestGetDuration() {
s.Equal(time.Duration(0), s.config.GetDuration("INVALID_DURATION", time.Second))
}

func (s *ApplicationTestSuite) TestEnvStringFunction() {
// existing value
s.T().Setenv("ENVSTRING_VAR", "hello")
s.Equal("hello", s.config.EnvString("ENVSTRING_VAR"))
s.Equal("hello", s.customConfig.EnvString("ENVSTRING_VAR"))

// default used when not set
s.Equal("fallback", s.config.EnvString("ENVSTRING_NOT_SET", "fallback"))

// empty string -> use provided default, otherwise empty string
s.T().Setenv("ENVSTRING_EMPTY", "")
s.Equal("fallback", s.config.EnvString("ENVSTRING_EMPTY", "fallback"))
s.Equal("", s.config.EnvString("ENVSTRING_EMPTY"))
}

func (s *ApplicationTestSuite) TestEnvBoolFunction() {
// true/false values
s.T().Setenv("ENVBOOL_TRUE", "true")
s.True(s.config.EnvBool("ENVBOOL_TRUE"))
s.T().Setenv("ENVBOOL_FALSE", "false")
s.False(s.config.EnvBool("ENVBOOL_FALSE"))

// not set -> default respected
s.True(s.config.EnvBool("ENVBOOL_NOT_SET", true))
s.False(s.config.EnvBool("ENVBOOL_NOT_SET2", false))

// empty string -> use default if provided; otherwise cast to false
s.T().Setenv("ENVBOOL_EMPTY", "")
s.True(s.config.EnvBool("ENVBOOL_EMPTY", true))
s.False(s.config.EnvBool("ENVBOOL_EMPTY"))

// invalid -> false
s.T().Setenv("ENVBOOL_INVALID", "invalid")
s.False(s.config.EnvBool("ENVBOOL_INVALID"))
}

func TestOsVariables(t *testing.T) {
t.Setenv("APP_KEY", "12345678901234567890123456789013")
t.Setenv("APP_NAME", "goravel")
Expand Down
Loading
Loading