pull/10/head v0.27.1
Hunter Long 2018-06-28 16:28:55 -07:00
parent b4ee5ae514
commit 473419fefb
14 changed files with 237 additions and 213 deletions

33
.env Normal file
View File

@ -0,0 +1,33 @@
###########################
## Database Information #
###########################
DB_CONNECTION=postgres
DB_HOST=localhost
DB_PORT=5432
DB_USER=root
DB_PASS=password123
DB_DATABASE=root
###########################
## STATUP PAGE SETTINGS #
###########################
NAME=Demo
DESCRIPTION=This is an awesome page
DOMAIN=https://domain.com
ADMIN_USER=admin
ADMIN_PASS=admin
ADMIN_EMAIL=info@admin.com
USE_CDN=true
###########################
## System Values ##
###########################
IS_DOCKER=true
IS_AWS=true
SASS=/usr/local/bin/sass
BASH_ENV=/bin/bash

View File

@ -18,7 +18,7 @@ services:
env:
global:
- VERSION=0.27
- VERSION=0.27.1
- DB_HOST=localhost
- DB_USER=travis
- DB_PASS=

View File

@ -2,9 +2,9 @@
APP="statup"
REPO="hunterlong/statup"
SASS=1.7.1
# COMPILE BOOTSTRAP
rm -rf bootstrap
git clone https://github.com/twbs/bootstrap.git
cd bootstrap
npm install
@ -16,7 +16,7 @@ cd ../
rm -rf bootstrap
# RENDERING CSS
gem install sass
#gem install sass
sass html/scss/base.scss html/css/base.css
# MIGRATION SQL FILE FOR CURRENT VERSION

View File

@ -15,6 +15,7 @@ RUN wget https://assets.statup.io/sass && \
chmod +x sass && \
mv sass /usr/local/bin/sass
ENV SASS=/usr/local/bin/sass
ENV CMD_FILE=/usr/bin/cmd
RUN printf "#!/usr/bin/env sh\n\$1\n" > $CMD_FILE && \
chmod +x $CMD_FILE

View File

@ -30,9 +30,11 @@ func MakePublicFolder(folder string) {
}
func CompileSASS() {
cmdBin := os.Getenv("CMD_FILE")
cmdBin := os.Getenv("SASS")
shell := os.Getenv("BASH_ENV")
fmt.Println("Compiling SASS into /css/base.css...")
testCmd := exec.Command(cmdBin, "sass assets/scss/base.scss assets/css/base.css")
command := fmt.Sprintf("%v %v %v", cmdBin, "assets/scss/base.scss", "assets/css/base.css")
testCmd := exec.Command(shell, command)
_, err := testCmd.Output()
if err != nil {
fmt.Println(err)

34
cli.go
View File

@ -2,6 +2,7 @@ package main
import (
"fmt"
"github.com/joho/godotenv"
"os"
"time"
)
@ -29,6 +30,39 @@ func CatchCLI(args []string) {
HelpEcho()
case "update":
fmt.Println("Sorry updating isn't available yet!")
case "run":
fmt.Println("Running 1 time and saving to database...")
var err error
configs, err = LoadConfig()
if err != nil {
fmt.Println("config.yml file not found")
os.Exit(1)
}
err = DbConnection(configs.Connection)
if err != nil {
throw(err)
}
core, err = SelectCore()
if err != nil {
fmt.Println("Core database was not found, Statup is not setup yet.")
}
services, _ = SelectAllServices()
for _, s := range services {
out := s.Check()
fmt.Printf(" Service %v | URL: %v | Latency: %0.0fms | Online: %v\n", out.Name, out.Domain, (out.Latency * 1000), out.Online)
}
fmt.Println("Check is complete.")
case "env":
fmt.Println("Statup Environment Variables")
envs, err := godotenv.Read(".env")
if err != nil {
fmt.Println("No .env file found in current directory.")
os.Exit(1)
}
for k, e := range envs {
fmt.Printf("%v=%v\n", k, e)
}
default:
fmt.Println("Statup does not have the command you entered.")
os.Exit(1)

View File

@ -1,22 +0,0 @@
package main
import (
"fmt"
"strings"
)
func (f *Failure) ParseError() string {
err := strings.Contains(f.Issue, "operation timed out")
if err {
return fmt.Sprintf("HTTP Request Timed Out")
}
err = strings.Contains(f.Issue, "x509: certificate is valid")
if err {
return fmt.Sprintf("SSL Certificate invalid")
}
err = strings.Contains(f.Issue, "no such host")
if err {
return fmt.Sprintf("Domain is offline or not found")
}
return f.Issue
}

View File

@ -1,15 +1,3 @@
/*
Main Design
=================
- Background
- Boxes
- Font Colors
- div widths
*/
/*
Card Design
================
*/
HTML, BODY {
background-color: #fcfcfc;
}
@ -231,5 +219,3 @@ HTML, BODY {
border-bottom-left-radius: 0;
}
}
/*# sourceMappingURL=base.css.map */

View File

@ -1,4 +1,4 @@
@import 'variables';
@import '_variables';
HTML,BODY {

View File

@ -1,28 +0,0 @@
/*
Main Design
=================
- Background
- Boxes
- Font Colors
- div widths
*/
$background-color: #fcfcfc;
$max-width: 860px;
$online-color: #47d337;
$offline-color: #dd3545;
/*
Card Design
================
*/
$card-background: #fff;
$card-stats-color: #474747;
$card-stats-size: 26pt;

View File

@ -7,6 +7,7 @@ import (
"github.com/go-yaml/yaml"
"github.com/gorilla/sessions"
"github.com/hunterlong/statup/plugin"
"github.com/joho/godotenv"
"golang.org/x/crypto/bcrypt"
"io"
"io/ioutil"
@ -92,6 +93,13 @@ func DownloadFile(filepath string, url string) error {
return nil
}
func init() {
err := godotenv.Load()
if err != nil {
fmt.Println("Error loading .env file")
}
}
func main() {
if len(os.Args) >= 2 {
CatchCLI(os.Args)

Binary file not shown.

View File

@ -95,11 +95,6 @@ func (s *Service) Online24() float32 {
return s.Online24Hours
}
type GraphJson struct {
X string `json:"x"`
Y float64 `json:"y"`
}
type DateScan struct {
CreatedAt time.Time `json:"x"`
Value int64 `json:"y"`

View File

@ -6,9 +6,24 @@ import (
"html/template"
"io/ioutil"
"log"
"strings"
)
var httpFunctions template.FuncMap
func (f *Failure) ParseError() string {
err := strings.Contains(f.Issue, "operation timed out")
if err {
return fmt.Sprintf("HTTP Request Timed Out")
}
err = strings.Contains(f.Issue, "x509: certificate is valid")
if err {
return fmt.Sprintf("SSL Certificate invalid")
}
err = strings.Contains(f.Issue, "no such host")
if err {
return fmt.Sprintf("Domain is offline or not found")
}
return f.Issue
}
func ExportIndexHTML() string {
core.OfflineAssets = true