go fmt
This commit is contained in:
parent
d474112fd2
commit
efd920cb04
7 changed files with 35 additions and 21 deletions
|
@ -1,14 +1,12 @@
|
|||
package bus
|
||||
|
||||
import (
|
||||
)
|
||||
import ()
|
||||
|
||||
type Bus struct {
|
||||
}
|
||||
|
||||
func New() *Bus {
|
||||
bus := &Bus{
|
||||
}
|
||||
bus := &Bus{}
|
||||
|
||||
return bus
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ type ServeOptions struct {
|
|||
func Command(cfg *config.Config) *cobra.Command {
|
||||
opts := makeOptions(cfg)
|
||||
serveCmd := &cobra.Command{
|
||||
Use: "serve",
|
||||
Use: "serve",
|
||||
Short: "starts the " + common.AppName + " server",
|
||||
RunE: common.RunE(opts),
|
||||
RunE: common.RunE(opts),
|
||||
}
|
||||
|
||||
return serveCmd
|
||||
|
|
|
@ -16,11 +16,11 @@ type Config struct {
|
|||
}
|
||||
|
||||
const (
|
||||
IncludeTag = "!include"
|
||||
IncludeDirNamedTag = "!include_dir_named"
|
||||
IncludeDirListTag = "!include_dir_list"
|
||||
IncludeTag = "!include"
|
||||
IncludeDirNamedTag = "!include_dir_named"
|
||||
IncludeDirListTag = "!include_dir_list"
|
||||
IncludeDirMergeNamedTag = "!include_dir_merge_named"
|
||||
SecretTag = "!secret"
|
||||
SecretTag = "!secret"
|
||||
)
|
||||
|
||||
func (c *Config) UnmarshalYAML(y *yaml.Node) error {
|
||||
|
@ -41,7 +41,7 @@ func (c *Config) UnmarshalYAML(y *yaml.Node) error {
|
|||
for i := 0; i < len(y.Content); i += 2 {
|
||||
k, v := y.Content[i], y.Content[i+1]
|
||||
|
||||
switch v.LongTag() {
|
||||
switch v.LongTag() {
|
||||
case IncludeTag:
|
||||
fallthrough
|
||||
case IncludeDirNamedTag:
|
||||
|
|
|
@ -18,7 +18,7 @@ func ReadConfig() (*Config, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
cfgPath := path.Join(home, "/." + common.AppName, "/config.yaml")
|
||||
cfgPath := path.Join(home, "/."+common.AppName, "/config.yaml")
|
||||
|
||||
r, err := os.Open(cfgPath)
|
||||
if err != nil {
|
||||
|
|
|
@ -13,14 +13,13 @@ type AuthProvider interface {
|
|||
}
|
||||
|
||||
type AuthProviderBase struct {
|
||||
Name string `json:"name"`
|
||||
ID *string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
ID *string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
|
||||
func (bp *AuthProviderBase) ProviderName() string { return bp.Name }
|
||||
func (bp *AuthProviderBase) ProviderID() *string { return bp.ID }
|
||||
func (bp *AuthProviderBase) ProviderID() *string { return bp.ID }
|
||||
func (bp *AuthProviderBase) ProviderType() string { return bp.Type }
|
||||
|
||||
type LocalProvider struct {
|
||||
|
@ -69,3 +68,20 @@ func (s *Server) authorizeHandler(w http.ResponseWriter, r *http.Request) {
|
|||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
type flowRequest struct {
|
||||
ClientID string `json:"client_id"`
|
||||
Handler []*string `json:"handler"`
|
||||
RedirectURI string `json:"redirect_uri"`
|
||||
}
|
||||
|
||||
func (s *Server) loginFlowHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var flowReq flowRequest
|
||||
err := json.NewDecoder(r.Body).Decode(&flowReq)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ type Server struct {
|
|||
*bus.Bus
|
||||
*http.Server
|
||||
rootFS fs.FS
|
||||
wg sync.WaitGroup
|
||||
cfg *config.Config
|
||||
wg sync.WaitGroup
|
||||
cfg *config.Config
|
||||
}
|
||||
|
||||
type StatusWriter struct {
|
||||
|
@ -48,7 +48,7 @@ func New(cfg *config.Config) (s *Server, err error) {
|
|||
s = &Server{
|
||||
Bus: bus.New(),
|
||||
Server: &http.Server{
|
||||
Addr: cfg.Server.Bind,
|
||||
Addr: cfg.Server.Bind,
|
||||
Handler: mux,
|
||||
},
|
||||
cfg: cfg,
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
)
|
||||
|
||||
var upgrader = websocket.Upgrader{
|
||||
ReadBufferSize: 1024,
|
||||
ReadBufferSize: 1024,
|
||||
WriteBufferSize: 1024,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue