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",
"smtp" : {
"server" : "smtp.example.com",
"host" : "smtp.example.com",
"port" : 25,
"user" : "username",
"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.
*/
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
http.Handle("/", createRouter())
http.ListenAndServe("localhost:3333", nil)
type SMTPServer struct {
Server string `json:"host"`
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;
font-family: 'Open Sans', sans-serif;
}
.header {
margin-top:10px;
}

View File

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