add new config parameters to the setup procedure

This commit is contained in:
Anton Markelov 2017-03-10 16:59:29 +10:00
parent 8ada2d0b95
commit ff31d42cca
3 changed files with 43 additions and 1 deletions

View File

@ -22,7 +22,8 @@ if [ "$1" == "ci_test" ]; then
"name": "circle_test"
},
"session_db": "127.0.0.1:6379",
"port": ":8010"
"port": ":8010",
"email_alert": false
}
EOF

View File

@ -27,6 +27,7 @@ ${SEMAPHORE_ADMIN}
${SEMAPHORE_ADMIN_EMAIL}
${SEMAPHORE_ADMIN_NAME}
${SEMAPHORE_ADMIN_PASSWORD}
n
EOF
fi

View File

@ -191,4 +191,44 @@ func (conf *configType) Scan() {
conf.TmpPath = "/tmp/semaphore"
}
conf.TmpPath = path.Clean(conf.TmpPath)
var alertanswer string
fmt.Print(" > Do you need an email alerts (y/n, default n): ")
fmt.Scanln(&alertanswer)
if alertanswer == "yes" || alertanswer == "y" {
conf.EmailAlert = true
fmt.Print(" > Mail server host (default localhost): ")
fmt.Scanln(&conf.EmailHost)
if len(conf.EmailHost) == 0 {
conf.EmailHost = "localhost"
}
fmt.Print(" > Mail server port (default 25): ")
fmt.Scanln(&conf.EmailPort)
if len(conf.EmailPort) == 0 {
conf.EmailPort = "25"
}
fmt.Print(" > Mail sender address (default semaphore@localhost): ")
fmt.Scanln(&conf.EmailSender)
if len(conf.EmailSender) == 0 {
conf.EmailSender = "semaphore@localhost"
}
fmt.Print(" > Web root URL (default http://localhost:8010/): ")
fmt.Scanln(&conf.WebHost)
if len(conf.WebHost) == 0 {
conf.WebHost = "http://localhost:8010/"
}
} else {
conf.EmailAlert = false
}
}