Merge pull request #4 from flohoss/dev

Cleanup, remove overhead
This commit is contained in:
Florian Hoss 2022-10-24 09:01:22 +02:00 committed by GitHub
commit f1485ecf6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 77 additions and 240 deletions

View file

@ -2,10 +2,6 @@ FROM golang:alpine AS go
RUN apk add nodejs npm
WORKDIR /backend
COPY ./swagger.sh .
RUN chmod +x swagger.sh
RUN ./swagger.sh install
COPY ./go.mod .
RUN go mod download
@ -15,7 +11,6 @@ RUN npm install
COPY . .
RUN npm run build
RUN ./swagger.sh init
RUN go build -o app
FROM alpine AS logo

View file

@ -58,7 +58,6 @@ The name and related link can be provided as well.
```toml
PORT = 4000
ALLOWED_HOSTS = "http://localhost:4000"
SWAGGER = false
LOG_LEVEL = "info"
@ -67,6 +66,8 @@ LOCATION_LONGITUDE = 9.177968320179422
OPEN_WEATHER_KEY = ""
OPEN_WEATHER_UNITS = "metric"
OPEN_WEATHER_LANG = "en"
LIVE_SYSTEM = true
```
## A docker-compose example:
@ -100,6 +101,8 @@ services:
# location is needed for weather
- LOCATION_LATITUDE=48.644929601442485
- LOCATION_LONGITUDE=9.349618464869025
# show live system information
- LIVE_SYSTEM=true
volumes:
# to mount the bookmarks.json and the icons folder on the system
- ./storage:/app/storage

View file

@ -1,5 +1,4 @@
{
"port": 4000,
"allowed_hosts": "http://localhost:4000",
"swagger": false
"allowed_hosts": "http://localhost:4000"
}

13
go.mod
View file

@ -13,23 +13,14 @@ require (
github.com/shirou/gopsutil/v3 v3.22.9
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.13.0
github.com/swaggo/http-swagger v1.3.3
github.com/swaggo/swag v1.8.7
github.com/unjx-de/go-folder v1.0.7
)
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/spec v0.20.7 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
@ -38,14 +29,12 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.5.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.2.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect

43
go.sum
View file

@ -38,8 +38,6 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
@ -48,7 +46,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/dariubs/percent v1.0.0 h1:fY8q40FRYaCiFZ0gTOa73Cmp21hS32w+tSSmqbGnUzc=
github.com/dariubs/percent v1.0.0/go.mod h1:NDZpkezJ8QqyIW/510MywB5T2KdC8v/0oTlEoPcMsRM=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -74,17 +71,6 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA=
github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
github.com/go-openapi/spec v0.20.7 h1:1Rlu/ZrOCCob0n+JKKJAWhNWMPW8bOZRg8FJaY+0SKI=
github.com/go-openapi/spec v0.20.7/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@ -151,31 +137,23 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c h1:VtwQ41oftZwlMnOEbMWQtSEUgU64U4s+GHk7hZK+jtY=
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE=
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg=
@ -207,22 +185,14 @@ github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+z
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a h1:kAe4YSu0O0UFn1DowNo2MY5p6xzqtJ/wQ7LZynSvGaY=
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w=
github.com/swaggo/http-swagger v1.3.3 h1:Hu5Z0L9ssyBLofaama21iYaF2VbWyA8jdohaaCGpHsc=
github.com/swaggo/http-swagger v1.3.3/go.mod h1:sE+4PjD89IxMPm77FnkDz0sdO+p5lbXzrVWT6OTVVGo=
github.com/swaggo/swag v1.8.7 h1:2K9ivTD3teEO+2fXV6zrZKDqk5IuU2aJtBDo8U7omWU=
github.com/swaggo/swag v1.8.7/go.mod h1:ezQVUUhly8dludpVk+/PuwJWvLLanB13ygV5Pr9enSk=
github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
@ -282,7 +252,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -314,9 +283,6 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -370,7 +336,6 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@ -387,7 +352,6 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -440,8 +404,6 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -536,8 +498,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
@ -545,7 +507,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View file

@ -1,8 +1,7 @@
{
"scripts": {
"dev": "npx tailwindcss -i ./static/css/input.css -o ./static/css/style.css --watch",
"build": "npx tailwindcss -i ./static/css/input.css -o ./static/css/style.css",
"types:openapi": "openapi -i ./docs/swagger.json -o ./templates/openapi"
"build": "npx tailwindcss -i ./static/css/input.css -o ./static/css/style.css"
},
"devDependencies": {
"openapi-typescript": "^5.4.1",

View file

@ -1,29 +1,24 @@
package server
import (
"github.com/go-chi/chi/v5"
"godash/files"
"net/http"
)
func (server *Server) setupRouter() {
server.Router.Get("/", launchpad)
server.Router.Route("/api", func(r chi.Router) {
r.Route("/system", func(r chi.Router) {
r.Get("/static", routeStaticSystem)
r.Get("/live", routeLiveSystem)
r.Get("/ws", webSocket)
})
r.Get("/weather", getWeather)
})
server.Router.Get("/ws", webSocket)
server.serveStatic("static")
server.serveStatic("storage/icons")
server.Router.Get("/robots.txt", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, files.TemplatesFolder+"/robots.txt")
})
server.Router.Get("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "static/favicon/favicon.ico")
})
server.serveStatic("static")
server.serveStatic("storage/icons")
server.Router.NotFound(func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
})

View file

@ -6,7 +6,6 @@ import (
"godash/bookmark"
"godash/files"
"godash/hub"
"godash/message"
"godash/system"
"godash/weather"
"net/http"
@ -16,68 +15,20 @@ type launchpadInformation struct {
Title string
Host string
Bookmarks []bookmark.Bookmark
Weather weather.OpenWeatherApiResponse
Weather weather.Weather
System system.System
}
func launchpad(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
files.ParseAndServeHtml(w, "index.gohtml", launchpadInformation{
Title: "Godash",
Title: "GoDash",
Bookmarks: bookmark.Bookmarks,
Weather: weather.CurrentOpenWeather,
Weather: weather.CurrentWeather,
System: system.Sys,
})
}
// @Schemes
// @Summary get the current weather
// @Description gets the current weather
// @Tags weather
// @Produce json
// @Success 200 {object} weather.OpenWeatherApiResponse
// @Success 204 {object} message.Response
// @Router /weather [get]
func getWeather(w http.ResponseWriter, r *http.Request) {
if weather.Conf.OpenWeather.Key != "" {
jsonResponse(w, weather.CurrentOpenWeather, http.StatusOK)
} else {
jsonResponse(w, message.Response{Message: message.NotFound.String()}, http.StatusNoContent)
}
}
// @Schemes
// @Summary live system information
// @Description gets live information of the system
// @Tags system
// @Produce json
// @Success 200 {object} system.LiveInformation
// @Success 204 {object} message.Response
// @Router /system/live [get]
func routeLiveSystem(w http.ResponseWriter, r *http.Request) {
if system.Config.LiveSystem {
jsonResponse(w, system.Sys.Live, http.StatusOK)
} else {
jsonResponse(w, message.Response{Message: message.NotFound.String()}, http.StatusNoContent)
}
}
// @Schemes
// @Summary static system information
// @Description gets static information of the system
// @Tags system
// @Produce json
// @Success 200 {object} system.StaticInformation
// @Success 204 {object} message.Response
// @Router /system/static [get]
func routeStaticSystem(w http.ResponseWriter, r *http.Request) {
if system.Config.LiveSystem {
jsonResponse(w, system.Sys.Static, http.StatusOK)
} else {
jsonResponse(w, message.Response{Message: message.NotFound.String()}, http.StatusNoContent)
}
}
func webSocket(w http.ResponseWriter, r *http.Request) {
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {

View file

@ -26,7 +26,6 @@ func NewServer() {
server.Hub = hub.NewHub()
server.setupMiddlewares()
server.setupRouter()
server.setupSwagger()
server.Listen()
}

View file

@ -1,28 +0,0 @@
package server
import (
"github.com/sirupsen/logrus"
httpSwagger "github.com/swaggo/http-swagger"
"godash/docs"
"net/http"
"net/url"
)
func redirectToSwagger(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/swagger/index.html", http.StatusTemporaryRedirect)
}
func (server *Server) setupSwagger() {
if server.Swagger {
docs.SwaggerInfo.Title = "GoDash"
docs.SwaggerInfo.Version = "1.0.0"
docs.SwaggerInfo.BasePath = "/api"
parsed, _ := url.Parse(server.AllowedHosts[0])
docs.SwaggerInfo.Host = parsed.Host
server.Router.Get("/swagger", redirectToSwagger)
server.Router.Get("/swagger/", redirectToSwagger)
server.Router.Get("/swagger/*", httpSwagger.Handler())
logrus.WithField("url", server.AllowedHosts[0]+"/swagger").Info("swagger running")
}
}

View file

@ -1,6 +1,6 @@
// webSocket
const WsType = { Weather: 0, System: 1 };
const apiBase = window.location.origin + "/api";
const wsUrl = (window.location.origin.replace("http", "ws") )+ "/ws";
let timeOut = 1;
connect();
@ -20,7 +20,7 @@ const systemDiskPercentage = document.getElementById("systemDiskPercentage");
const systemDiskValue = document.getElementById("systemDiskValue");
function connect() {
let ws = new WebSocket(apiBase.replace("http", "ws") + "/system/ws");
let ws = new WebSocket(wsUrl);
ws.onopen = () => {
console.log("WebSocket is open.");
timeOut = 1;
@ -40,12 +40,12 @@ function handleMessage(parsed) {
}
function replaceWeather(parsed) {
weatherIcon.setAttribute("xlink:href", "#" + parsed.weather[0].icon);
weatherTemp.innerText = parsed.main.temp;
weatherDescription.innerText = parsed.weather[0].description;
weatherHumidity.innerText = parsed.main.humidity;
weatherSunrise.innerText = parsed.sys.str_sunrise;
weatherSunset.innerText = parsed.sys.str_sunset;
weatherIcon.setAttribute("xlink:href", "#" + parsed.icon);
weatherTemp.innerText = parsed.temp;
weatherDescription.innerText = parsed.description;
weatherHumidity.innerText = parsed.humidity;
weatherSunrise.innerText = parsed.sunrise;
weatherSunset.innerText = parsed.sunset;
}
function replaceSystem(parsed) {

View file

@ -1,18 +0,0 @@
#!/bin/sh
action=$1
case $action in
"install")
go install github.com/swaggo/swag/cmd/swag@latest
;;
"init")
swag init -g server/swagger.go
;;
"format")
swag fmt
;;
*)
exit 0
;;
esac

View file

@ -195,13 +195,6 @@
/>
<path fill="currentColor" fill-rule="evenodd" d="M4.553 7.776c.82-1.641 1.717-2.753 2.093-3.13l.708.708c-.29.29-1.128 1.311-1.907 2.87l-.894-.448z" />
</symbol>
<symbol id="location" viewBox="0 0 16 16">
<path
fill="currentColor"
fill-rule="evenodd"
d="M4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z"
/>
</symbol>
<symbol id="quote" viewBox="0 0 16 16">
<path
fill="currentColor"

View file

@ -8,50 +8,38 @@
{{ template "systemIcons" . }}
{{ template "weatherIcons" . }}
{{ if .Weather.Name }}
{{ if .Weather.Icon }}
<div class="flex items-center mb-6 md:mb-10 select-none">
<svg class="shrink-0 w-20 h-20 md:w-14 md:h-14 mr-5">
{{ range .Weather.Weather }}
<use id="weatherIcon" xlink:href="#{{ .Icon }}"></use>
{{ end }}
<use id="weatherIcon" xlink:href="#{{ .Weather.Icon }}"></use>
</svg>
<div class="flex flex-col md:flex-row">
<div class="text-4xl font-bold mr-8"><span id="weatherTemp">{{ .Weather.Main.Temp }}</span> {{ .Weather.Units }}</div>
<div class="text-4xl font-bold mr-8"><span id="weatherTemp">{{ .Weather.Temp }}</span> {{ .Weather.Units }}</div>
<div class="flex flex-col md:flex-row mt-1 text-sm text-slate-700 dark:text-slate-300">
<div class="flex items-center md:mr-5">
<svg width="14" height="14" class="mr-2">
<use xlink:href="#quote"></use>
</svg>
<div>
{{ range .Weather.Weather }}
<div id="weatherDescription">{{ .Description }}</div>
{{ end }}
</div>
<div id="weatherDescription">{{ .Weather.Description }}</div>
</div>
<div class="flex items-center md:mr-5">
<svg width="14" height="14" class="mr-2">
<use xlink:href="#humidity"></use>
</svg>
<span id="weatherHumidity">{{ .Weather.Main.Humidity }}</span>%
<span id="weatherHumidity">{{ .Weather.Humidity }}</span>%
</div>
<div class="hidden lg:flex items-center">
<div class="flex items-center md:mr-5">
<svg width="15" height="15" class="mr-2">
<use xlink:href="#location"></use>
</svg>
{{ .Weather.Name }}
</div>
<div class="hidden md:flex items-center">
<div class="flex items-center md:mr-5">
<svg width="18" height="18" class="mr-2 mt-1">
<use xlink:href="#sunrise"></use>
</svg>
<div id="weatherSunrise">{{ .Weather.Sys.StrSunrise }}</div>
<div id="weatherSunrise">{{ .Weather.Sunrise }}</div>
</div>
<div class="flex items-center md:mr-5">
<svg width="18" height="18" class="mr-2 mt-1">
<use xlink:href="#sunset"></use>
</svg>
<div id="weatherSunset">{{ .Weather.Sys.StrSunset }}</div>
<div id="weatherSunset">{{ .Weather.Sunset }}</div>
</div>
</div>
</div>
@ -60,14 +48,14 @@
{{ end }}
{{ if .System.Static.CPU.Name }}
<div class="grid grid-cols-1 md:grid-cols-3 gap-5 mb-6 md:mb-10 select-none text-sm">
<div class="grid grid-cols-1 md:grid-cols-3 gap-5 mb-6 md:mb-10 select-none text-sm text-slate-700 dark:text-slate-300">
<div class="flex items-center">
<svg class="h-8 w-8 shrink-0 mr-2 text-slate-700 dark:text-slate-300">
<svg class="h-7 w-7 shrink-0 mr-3">
<use xlink:href="#cpu"></use>
</svg>
<div class="w-full truncate">
<div class="truncate">{{ .System.Static.CPU.Name }}</div>
<div class="text-xs text-slate-700 dark:text-slate-300 truncate">{{ .System.Static.CPU.Threads }}</div>
<div class="text-xs truncate">{{ .System.Static.CPU.Threads }}</div>
<div class="bg-slate-300 dark:bg-slate-700 h-px mt-1">
<div
id="systemCpuPercentage"
@ -78,12 +66,12 @@
</div>
</div>
<div class="flex items-center">
<svg class="h-8 w-8 shrink-0 mr-2 text-slate-700 dark:text-slate-300">
<svg class="h-7 w-7 shrink-0 mr-3">
<use xlink:href="#ram"></use>
</svg>
<div class="w-full truncate">
<div class="truncate"><span id="systemRamValue">{{ .System.Live.Ram.Value }}</span> / {{ .System.Static.Ram.Total }}</div>
<div class="text-xs text-slate-700 dark:text-slate-300 truncate">{{ .System.Static.Ram.Swap }}</div>
<div class="text-xs truncate">{{ .System.Static.Ram.Swap }}</div>
<div class="bg-slate-300 dark:bg-slate-700 h-px mt-1">
<div
id="systemRamPercentage"
@ -94,12 +82,12 @@
</div>
</div>
<div class="flex items-center">
<svg class="h-8 w-8 shrink-0 mr-2 text-slate-700 dark:text-slate-300">
<svg class="h-7 w-7 shrink-0 mr-3">
<use xlink:href="#disk"></use>
</svg>
<div class="w-full truncate">
<div class="truncate"><span id="systemDiskValue">{{ .System.Live.Disk.Value }}</span> / {{ .System.Static.Disk.Total }}</div>
<div class="text-xs text-slate-700 dark:text-slate-300 truncate">{{ .System.Static.Disk.Partitions }}</div>
<div class="text-xs truncate">{{ .System.Static.Disk.Partitions }}</div>
<div class="bg-slate-300 dark:bg-slate-700 h-px mt-1">
<div
id="systemDiskPercentage"

View file

@ -17,27 +17,33 @@ type OpenWeather struct {
Lang string
}
type Weather struct {
Icon string `json:"icon"`
Temp float32 `json:"temp"`
Description string `json:"description"`
Humidity float32 `json:"humidity"`
Sunrise string `json:"sunrise"`
Sunset string `json:"sunset"`
Units string `json:"units"`
}
type OpenWeatherApiResponse struct {
Weather []OpenWeatherApiWeather `json:"weather" `
Main OpenWeatherApiMain `json:"main" `
Sys OpenWeatherApiSys `json:"sys" `
Name string `json:"name" `
Units string `json:"units" `
Weather []OpenWeatherApiWeather `json:"weather"`
Main OpenWeatherApiMain `json:"main"`
Sys OpenWeatherApiSys `json:"sys"`
}
type OpenWeatherApiWeather struct {
Description string `json:"description" `
Icon string `json:"icon" `
Description string `json:"description"`
Icon string `json:"icon"`
}
type OpenWeatherApiMain struct {
Temp float32 `json:"temp" `
Humidity float32 `json:"humidity" `
Temp float32 `json:"temp"`
Humidity float32 `json:"humidity"`
}
type OpenWeatherApiSys struct {
Sunrise int64 `json:"sunrise"`
Sunset int64 `json:"sunset"`
StrSunrise string `json:"str_sunrise"`
StrSunset string `json:"str_sunset"`
Sunrise int64 `json:"sunrise"`
Sunset int64 `json:"sunset"`
}

View file

@ -12,7 +12,7 @@ import (
)
var Conf = Config{}
var CurrentOpenWeather = OpenWeatherApiResponse{}
var CurrentWeather = Weather{}
func NewWeather() {
config.ParseViperConfig(&Conf, config.AddViperConfig("weather"))
@ -24,20 +24,25 @@ func NewWeather() {
func setWeatherUnits() {
if Conf.OpenWeather.Units == "imperial" {
CurrentOpenWeather.Units = "°F"
CurrentWeather.Units = "°F"
} else {
CurrentOpenWeather.Units = "°C"
CurrentWeather.Units = "°C"
}
}
func calcWeatherTimestamps() {
myTime := time.Unix(CurrentOpenWeather.Sys.Sunrise, 0)
CurrentOpenWeather.Sys.StrSunrise = myTime.Format("15:04")
myTime = time.Unix(CurrentOpenWeather.Sys.Sunset, 0)
CurrentOpenWeather.Sys.StrSunset = myTime.Format("15:04")
func copyWeatherValues(weatherResp *OpenWeatherApiResponse) {
myTime := time.Unix(weatherResp.Sys.Sunrise, 0)
CurrentWeather.Sunrise = myTime.Format("15:04")
myTime = time.Unix(weatherResp.Sys.Sunset, 0)
CurrentWeather.Sunset = myTime.Format("15:04")
CurrentWeather.Icon = weatherResp.Weather[0].Icon
CurrentWeather.Temp = weatherResp.Main.Temp
CurrentWeather.Description = weatherResp.Weather[0].Description
CurrentWeather.Humidity = weatherResp.Main.Humidity
}
func updateWeather(interval time.Duration) {
var weatherResponse OpenWeatherApiResponse
for {
resp, err := http.Get(fmt.Sprintf("https://api.openweathermap.org/data/2.5/weather?lat=%f&lon=%f&appid=%s&units=%s&lang=%s",
Conf.Location.Latitude,
@ -49,16 +54,16 @@ func updateWeather(interval time.Duration) {
logrus.Error("weather cannot be updated")
} else {
body, _ := io.ReadAll(resp.Body)
err = json.Unmarshal(body, &CurrentOpenWeather)
err = json.Unmarshal(body, &weatherResponse)
if err != nil {
logrus.Error("weather cannot be processed")
} else {
logrus.WithFields(logrus.Fields{"temp": fmt.Sprintf("%0.2f%s", CurrentOpenWeather.Main.Temp, CurrentOpenWeather.Units), "location": CurrentOpenWeather.Name}).Trace("weather updated")
copyWeatherValues(&weatherResponse)
logrus.WithFields(logrus.Fields{"temp": fmt.Sprintf("%0.2f%s", CurrentWeather.Temp, CurrentWeather.Units), "humidity": fmt.Sprintf("%0.2f%s", CurrentWeather.Humidity, "%")}).Trace("weather updated")
}
calcWeatherTimestamps()
resp.Body.Close()
}
hub.LiveInformationCh <- hub.Message{WsType: hub.Weather, Message: CurrentOpenWeather}
hub.LiveInformationCh <- hub.Message{WsType: hub.Weather, Message: CurrentWeather}
time.Sleep(interval)
}
}