+
Update {{github.tag_name}} Available
-
Download
-
Changelog
+
{{ $t('main_settings') }}
@@ -27,6 +33,9 @@
{{ $t('import') }}
+
+ {{ $t('configs') }}
+
{{$t('notifiers')}}
@@ -105,9 +114,13 @@
@@ -140,10 +153,12 @@
const Cache = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/Cache')
const Importer = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/Importer')
const Variables = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/Variables')
+ const Configs = () => import(/* webpackChunkName: "dashboard" */ '@/components/Dashboard/Configs')
export default {
name: 'Settings',
components: {
+ Configs,
Importer,
Variables,
OAuth,
diff --git a/go.mod b/go.mod
index a3ba74b1..4316ede4 100644
--- a/go.mod
+++ b/go.mod
@@ -6,6 +6,7 @@ go 1.14
require (
github.com/GeertJohan/go.rice v1.0.0
github.com/aws/aws-sdk-go v1.30.20
+ github.com/coreos/go-oidc v2.2.1+incompatible
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fatih/structs v1.1.0
github.com/foomo/simplecert v1.7.5
@@ -17,12 +18,13 @@ require (
github.com/jinzhu/gorm v1.9.12
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/pkg/errors v0.9.1
+ github.com/pquerna/cachecontrol v0.0.0-20200819021114-67c6ae64274f // indirect
github.com/prometheus/client_golang v1.1.0
github.com/sirupsen/logrus v1.5.0
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.6.3
github.com/statping/emails v1.0.0
- github.com/stretchr/testify v1.5.1
+ github.com/stretchr/testify v1.6.1
github.com/t-tiger/gorm-bulk-insert/v2 v2.0.1
github.com/tensorflow/tensorflow v2.3.0+incompatible // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
diff --git a/go.sum b/go.sum
index 18cc1f5f..c49f49fe 100755
--- a/go.sum
+++ b/go.sum
@@ -131,6 +131,8 @@ github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkE
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
+github.com/coreos/go-oidc v2.2.1+incompatible h1:mh48q/BqXqgjVHpy2ZY7WnWAbenxRjsz9N1i1YxjHAk=
+github.com/coreos/go-oidc v2.2.1+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
@@ -552,6 +554,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pquerna/cachecontrol v0.0.0-20200819021114-67c6ae64274f h1:JDEmUDtyiLMyMlFwiaDOv2hxUp35497fkwePcLeV7j4=
+github.com/pquerna/cachecontrol v0.0.0-20200819021114-67c6ae64274f/go.mod h1:hoLfEwdY11HjRfKFH6KqnPsfxlo3BP6bJehpDv8t6sQ=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8=
@@ -652,6 +656,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
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/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/t-tiger/gorm-bulk-insert/v2 v2.0.1 h1:HGVkRrwDCbmSP6h1CoBDj6l/mhnvsP5JbYaQ4ss0R6o=
@@ -1047,6 +1052,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.0.1 h1:omJoilUzyrAp0xNoio88lGJCroGdIOen9hq2A/+3ifw=
gorm.io/driver/mysql v1.0.1/go.mod h1:KtqSthtg55lFp3S5kUXqlGaelnWpKitn4k1xZTnoiPw=
gorm.io/driver/postgres v1.0.0 h1:Yh4jyFQ0a7F+JPU0Gtiam/eKmpT/XFc1FKxotGqc6FM=
diff --git a/handlers/dashboard.go b/handlers/dashboard.go
index ca7ddceb..8fb67ef8 100644
--- a/handlers/dashboard.go
+++ b/handlers/dashboard.go
@@ -261,6 +261,19 @@ func settingsImportHandler(w http.ResponseWriter, r *http.Request) {
sendJsonAction(exportData, "import", w, r)
}
+func configsSaveHandler(w http.ResponseWriter, r *http.Request) {
+
+}
+
+func configsViewHandler(w http.ResponseWriter, r *http.Request) {
+ db, err := configs.LoadConfigs(utils.Directory + "/configs.yml")
+ if err != nil {
+ sendErrorJson(err, w, r)
+ return
+ }
+ w.Write(db.ToYAML())
+}
+
func settingsExportHandler(w http.ResponseWriter, r *http.Request) {
exported, err := ExportSettings()
if err != nil {
diff --git a/handlers/oauth_custom.go b/handlers/oauth_custom.go
index fb595617..09e0e03f 100644
--- a/handlers/oauth_custom.go
+++ b/handlers/oauth_custom.go
@@ -11,9 +11,7 @@ import (
func customOAuth(r *http.Request) (*oAuth, error) {
auth := core.App.OAuth
code := r.URL.Query().Get("code")
-
scopes := strings.Split(auth.CustomScopes, ",")
-
config := &oauth2.Config{
ClientID: auth.CustomClientID,
ClientSecret: auth.CustomClientSecret,
diff --git a/handlers/routes.go b/handlers/routes.go
index e8448739..ed233d0e 100644
--- a/handlers/routes.go
+++ b/handlers/routes.go
@@ -103,6 +103,8 @@ func Router() *mux.Router {
api.Handle("/api/logs/last", authenticated(logsLineHandler, false)).Methods("GET")
api.Handle("/api/settings/import", authenticated(settingsImportHandler, false)).Methods("POST")
api.Handle("/api/settings/export", authenticated(settingsExportHandler, false)).Methods("GET")
+ api.Handle("/api/settings/configs", authenticated(configsViewHandler, false)).Methods("GET")
+ api.Handle("/api/settings/configs", authenticated(configsSaveHandler, false)).Methods("POST")
// API OAUTH Routes
api.Handle("/api/oauth", scoped(apiOAuthHandler)).Methods("GET")
diff --git a/notifiers/discord.go b/notifiers/discord.go
index 3443a323..da1e8d18 100644
--- a/notifiers/discord.go
+++ b/notifiers/discord.go
@@ -22,7 +22,7 @@ type discord struct {
var Discorder = &discord{¬ifications.Notification{
Method: "discord",
- Title: "discord",
+ Title: "Discord",
Description: "Send notifications to your discord channel using discord webhooks. Insert your discord channel Webhook URL to receive notifications. Based on the
discord webhooker API.",
Author: "Hunter Long",
AuthorUrl: "https://github.com/hunterlong",
diff --git a/notifiers/slack.go b/notifiers/slack.go
index f476da66..b95973cf 100644
--- a/notifiers/slack.go
+++ b/notifiers/slack.go
@@ -29,7 +29,7 @@ func (s *slack) Select() *notifications.Notification {
var slacker = &slack{¬ifications.Notification{
Method: slackMethod,
- Title: "slack",
+ Title: "Slack",
Description: "Send notifications to your slack channel when a service is offline. Insert your Incoming webhook URL for your channel to receive notifications. Based on the
Slack API.",
Author: "Hunter Long",
AuthorUrl: "https://github.com/hunterlong",
diff --git a/types/configs/methods.go b/types/configs/methods.go
index bbb08705..a9378b27 100644
--- a/types/configs/methods.go
+++ b/types/configs/methods.go
@@ -18,6 +18,15 @@ func (d *DbConfig) Save(directory string) error {
return nil
}
+func (d *DbConfig) ToYAML() []byte {
+ c, err := yaml.Marshal(d)
+ if err != nil {
+ log.Errorln(err)
+ return nil
+ }
+ return c
+}
+
func (d *DbConfig) ConnectionString() string {
var conn string
postgresSSL := utils.Params.GetString("POSTGRES_SSLMODE")
diff --git a/types/core/struct.go b/types/core/struct.go
index c54739dc..fdb0cd7c 100644
--- a/types/core/struct.go
+++ b/types/core/struct.go
@@ -45,24 +45,25 @@ type Core struct {
}
type OAuth struct {
- Providers string `gorm:"column:oauth_providers;" json:"oauth_providers"`
- GithubClientID string `gorm:"column:gh_client_id" json:"gh_client_id"`
- GithubClientSecret string `gorm:"column:gh_client_secret" json:"gh_client_secret" scope:"admin"`
- GithubUsers string `gorm:"column:gh_users" json:"gh_users" scope:"admin"`
- GithubOrgs string `gorm:"column:gh_orgs" json:"gh_orgs" scope:"admin"`
- GoogleClientID string `gorm:"column:google_client_id" json:"google_client_id"`
- GoogleClientSecret string `gorm:"column:google_client_secret" json:"google_client_secret" scope:"admin"`
- GoogleUsers string `gorm:"column:google_users" json:"google_users" scope:"admin"`
- SlackClientID string `gorm:"column:slack_client_id" json:"slack_client_id"`
- SlackClientSecret string `gorm:"column:slack_client_secret" json:"slack_client_secret" scope:"admin"`
- SlackTeam string `gorm:"column:slack_team" json:"slack_team" scope:"admin"`
- SlackUsers string `gorm:"column:slack_users" json:"slack_users" scope:"admin"`
- CustomName string `gorm:"column:custom_name" json:"custom_name"`
- CustomClientID string `gorm:"column:custom_client_id" json:"custom_client_id"`
- CustomClientSecret string `gorm:"column:custom_client_secret" json:"custom_client_secret" scope:"admin"`
- CustomEndpointAuth string `gorm:"column:custom_endpoint_auth" json:"custom_endpoint_auth"`
- CustomEndpointToken string `gorm:"column:custom_endpoint_token" json:"custom_endpoint_token" scope:"admin"`
- CustomScopes string `gorm:"column:custom_scopes" json:"custom_scopes"`
+ Providers string `gorm:"column:oauth_providers;" json:"oauth_providers"`
+ GithubClientID string `gorm:"column:gh_client_id" json:"gh_client_id"`
+ GithubClientSecret string `gorm:"column:gh_client_secret" json:"gh_client_secret" scope:"admin"`
+ GithubUsers string `gorm:"column:gh_users" json:"gh_users" scope:"admin"`
+ GithubOrgs string `gorm:"column:gh_orgs" json:"gh_orgs" scope:"admin"`
+ GoogleClientID string `gorm:"column:google_client_id" json:"google_client_id"`
+ GoogleClientSecret string `gorm:"column:google_client_secret" json:"google_client_secret" scope:"admin"`
+ GoogleUsers string `gorm:"column:google_users" json:"google_users" scope:"admin"`
+ SlackClientID string `gorm:"column:slack_client_id" json:"slack_client_id"`
+ SlackClientSecret string `gorm:"column:slack_client_secret" json:"slack_client_secret" scope:"admin"`
+ SlackTeam string `gorm:"column:slack_team" json:"slack_team" scope:"admin"`
+ SlackUsers string `gorm:"column:slack_users" json:"slack_users" scope:"admin"`
+ CustomName string `gorm:"column:custom_name" json:"custom_name"`
+ CustomClientID string `gorm:"column:custom_client_id" json:"custom_client_id"`
+ CustomClientSecret string `gorm:"column:custom_client_secret" json:"custom_client_secret" scope:"admin"`
+ CustomEndpointAuth string `gorm:"column:custom_endpoint_auth" json:"custom_endpoint_auth"`
+ CustomEndpointToken string `gorm:"column:custom_endpoint_token" json:"custom_endpoint_token" scope:"admin"`
+ CustomScopes string `gorm:"column:custom_scopes" json:"custom_scopes"`
+ CustomIsOpenID null.NullBool `gorm:"column:custom_open_id" json:"custom_open_id"`
}
// AllNotifiers contains all the Notifiers loaded