Added config file integration, updated some styles

pull/24/head
Jordan Wright 2013-12-06 17:39:40 -06:00
parent f32989b4c5
commit a3518032be
4 changed files with 36 additions and 6 deletions

View File

@ -1,7 +1,7 @@
{ {
"url" : "localhost:3333", "url" : "localhost:3333",
"smtp" : { "smtp" : {
"server" : "smtp.example.com", "host" : "smtp.example.com",
"port" : 25, "port" : 25,
"user" : "username", "user" : "username",
"pass" : "password" "pass" : "password"

View File

@ -26,10 +26,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
import ( import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http" "net/http"
"os"
) )
func main() { type SMTPServer struct {
http.Handle("/", createRouter()) Server string `json:"host"`
http.ListenAndServe("localhost:3333", nil) Port int `json:"port"`
User string `json:"user"`
Password string `json:"password"`
}
type Config struct {
URL string `json:"url"`
SMTP SMTPServer `json:"smtp"`
}
var config Config
func main() {
// Get the config file
config_file, e := ioutil.ReadFile("./config.json")
if e != nil {
fmt.Printf("File error: %v\n", e)
os.Exit(1)
}
json.Unmarshal(config_file, &config)
fmt.Printf("Gophish server started at http://%s\n", config.URL)
http.Handle("/", createRouter())
http.ListenAndServe(config.URL, nil)
} }

View File

@ -61,3 +61,7 @@ footer > p {
color:#444444; color:#444444;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
} }
.header {
margin-top:10px;
}

View File

@ -1,7 +1,7 @@
{{define "content"}} {{template "nav"}} {{define "content"}} {{template "nav"}}
<div class="jumbotron"> <div class="jumbotron">
<div class="container" style="text-align:center;"> <div class="container" style="text-align:center;">
<h1> <h1 class="header">
Dashboard Dashboard
</h1> </h1>
</div> </div>