Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AppFileCommand = &cli.Command{ Name: "config", Aliases: []string{"c"}, Flags: []cli.Flag{ &cli.StringFlag{ Name: "output", Aliases: []string{"o"}, Value: "application.yml", }, }, Action: func(c *cli.Context) error { filename := c.String("output") example := config.Config{ Logging: config.Logging{ Level: "debug or info or warn or warning(warn) or error or err(error) or critical or dev(debug) or prod(info)", }, Port: 8080, SslCertificate: "ssl/sever.crt", SslCertificateKey: "ssl/sever.key", Servers: []*config.Servers{ { ServerName: "virtual sever name", Login: "/oauth2/login", Callback: "/oauth2/callback", Logout: "/oauth2/logout", Logging: config.Logging{ Level: "debug or info or warn or warning(warn) or error or err(error) or critical or dev(debug) or prod(info)", }, Oidc: config.Oidc{ Scopes: []string{"email", "openid", "offline_access", "profile"}, Provider: "https://keycloak/", ClientId: "xxx", ClientSecret: "xxx", Logout: "https://keycloak/logout?returnTo=http://localhost:8080/oauth2/login", RedirectUrl: "http://localhost:8080/oauth2/callback", }, Locations: []config.Locations{ { ProxyPass: "http://localhost", Urls: []config.Urls{ { Path: "/", Token: "id_token", }, }, }, }, CacheConfig: config.Cache{ Name: "memory or etcd", Codecs: []string{}, Endpoints: []string{}, CacheTime: 30, }, }, }, } return example.Output(filename) }, }
View Source
var ProxyCommand = &cli.Command{ Name: "proxy", Usage: "proxy server", Subcommands: []*cli.Command{ { Name: "run", Aliases: []string{"r"}, Description: "proxy server run", Flags: []cli.Flag{ &cli.StringFlag{ Name: appConf, Aliases: []string{"c"}, Usage: "application file path", Value: "application.yaml", }, }, Action: func(c *cli.Context) error { https := true appWatcher, err := AppConfig(c.String(appConf)) if err != nil { return err } appConf := appWatcher.Watching.(*watchConfig.Watch).Config cmWatcher, err := CertConfig(appConf.SslCertificate, appConf.SslCertificateKey) if err != nil { if err == watch.ErrFileNotFound { https = false } else { return err } } multiHost := appWatcher.Watching.(*watchConfig.Watch).MultiHost defer multiHost.Close() s := &http.Server{ Addr: appConf.GetPort(), Handler: multiHost, } logger.Log.Info("Application Start") if https { s.TLSConfig = &tls.Config{ GetCertificate: cmWatcher.Watching.(*cert.Watch).GetCertificate, } return s.ListenAndServeTLS("", "") } else { return s.ListenAndServe() } }, }, }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.