-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.go
63 lines (52 loc) · 1.22 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"docker-symfony/commands"
"docker-symfony/util"
"fmt"
"github.com/symfony-cli/console"
"os"
"time"
)
var (
version = "dev"
channel = "dev"
buildDate string
)
func Init() {
currentDir := util.GetCurrentDir()
// Added for security
util.Chmod(currentDir+"/docker", 0700)
util.Chmod(currentDir, 0700)
env := currentDir + "/.env"
envDist := env + ".dist"
envSecret := env + ".secret"
envSecretDist := envSecret + ".dist"
if !util.FileExists(env) {
util.Copy(envDist, env)
}
if !util.FileExists(envSecret) {
util.Copy(envSecretDist, envSecret)
}
}
func main() {
Init()
args := os.Args
cmds := commands.CommonCommands()
app := &console.Application{
Name: "D4D",
Usage: "Docker Symfony gives you everything you need to develop a Symfony application. This complete stack runs with docker and docker-compose.",
Copyright: fmt.Sprintf("(c) 2018-%d D4D", time.Now().Year()),
Commands: cmds,
Action: func(ctx *console.Context) error {
if ctx.Args().Len() == 0 {
return commands.WelcomeAction(ctx)
}
return console.ShowAppHelpAction(ctx)
},
Before: commands.InitAppFunc,
Version: version,
Channel: channel,
BuildDate: buildDate,
}
app.Run(args)
}