mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-31 09:57:17 +02:00
config: remove source, remove deadcode, fix linting issues (#4118)
* remove source, remove deadcode, fix linting issues * use github action for lint * fix missing envoy
This commit is contained in:
parent
34c1e44c7e
commit
bbed421cd8
122 changed files with 438 additions and 998 deletions
|
@ -463,7 +463,7 @@ func (o *Options) viperIsSet(key string) bool {
|
|||
|
||||
// parseHeaders handles unmarshalling any custom headers correctly from the
|
||||
// environment or viper's parsed keys
|
||||
func (o *Options) parseHeaders(ctx context.Context) error {
|
||||
func (o *Options) parseHeaders(_ context.Context) error {
|
||||
var headers map[string]string
|
||||
if o.HeadersEnv != "" {
|
||||
// Handle JSON by default via viper
|
||||
|
@ -1094,51 +1094,6 @@ func (o *Options) GetAllRouteableGRPCHosts() ([]string, error) {
|
|||
return hosts.ToSlice(), nil
|
||||
}
|
||||
|
||||
// GetAllRouteableGRPCServerNames returns all the possible gRPC server names handled by the Pomerium options.
|
||||
func (o *Options) GetAllRouteableGRPCServerNames() ([]string, error) {
|
||||
hosts := sets.NewSorted[string]()
|
||||
|
||||
// authorize urls
|
||||
if IsAll(o.Services) {
|
||||
authorizeURLs, err := o.GetAuthorizeURLs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, u := range authorizeURLs {
|
||||
hosts.Add(urlutil.GetServerNamesForURL(u)...)
|
||||
}
|
||||
} else if IsAuthorize(o.Services) {
|
||||
authorizeURLs, err := o.GetInternalAuthorizeURLs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, u := range authorizeURLs {
|
||||
hosts.Add(urlutil.GetServerNamesForURL(u)...)
|
||||
}
|
||||
}
|
||||
|
||||
// databroker urls
|
||||
if IsAll(o.Services) {
|
||||
dataBrokerURLs, err := o.GetDataBrokerURLs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, u := range dataBrokerURLs {
|
||||
hosts.Add(urlutil.GetServerNamesForURL(u)...)
|
||||
}
|
||||
} else if IsDataBroker(o.Services) {
|
||||
dataBrokerURLs, err := o.GetInternalDataBrokerURLs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, u := range dataBrokerURLs {
|
||||
hosts.Add(urlutil.GetServerNamesForURL(u)...)
|
||||
}
|
||||
}
|
||||
|
||||
return hosts.ToSlice(), nil
|
||||
}
|
||||
|
||||
// GetAllRouteableHTTPHosts returns all the possible HTTP hosts handled by the Pomerium options.
|
||||
func (o *Options) GetAllRouteableHTTPHosts() ([]string, error) {
|
||||
hosts := sets.NewSorted[string]()
|
||||
|
@ -1159,9 +1114,14 @@ func (o *Options) GetAllRouteableHTTPHosts() ([]string, error) {
|
|||
// policy urls
|
||||
if IsProxy(o.Services) {
|
||||
for _, policy := range o.GetAllPolicies() {
|
||||
hosts.Add(urlutil.GetDomainsForURL(policy.Source.URL)...)
|
||||
fromURL, err := urlutil.ParseAndValidateURL(policy.From)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
hosts.Add(urlutil.GetDomainsForURL(fromURL)...)
|
||||
if policy.TLSDownstreamServerName != "" {
|
||||
tlsURL := policy.Source.URL.ResolveReference(&url.URL{Host: policy.TLSDownstreamServerName})
|
||||
tlsURL := fromURL.ResolveReference(&url.URL{Host: policy.TLSDownstreamServerName})
|
||||
hosts.Add(urlutil.GetDomainsForURL(tlsURL)...)
|
||||
}
|
||||
}
|
||||
|
@ -1170,37 +1130,6 @@ func (o *Options) GetAllRouteableHTTPHosts() ([]string, error) {
|
|||
return hosts.ToSlice(), nil
|
||||
}
|
||||
|
||||
// GetAllRouteableHTTPServerNames returns all the possible HTTP server names handled by the Pomerium options.
|
||||
func (o *Options) GetAllRouteableHTTPServerNames() ([]string, error) {
|
||||
serverNames := sets.NewSorted[string]()
|
||||
if IsAuthenticate(o.Services) {
|
||||
authenticateURL, err := o.GetInternalAuthenticateURL()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
serverNames.Add(urlutil.GetServerNamesForURL(authenticateURL)...)
|
||||
|
||||
authenticateURL, err = o.GetAuthenticateURL()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
serverNames.Add(urlutil.GetServerNamesForURL(authenticateURL)...)
|
||||
}
|
||||
|
||||
// policy urls
|
||||
if IsProxy(o.Services) {
|
||||
for _, policy := range o.GetAllPolicies() {
|
||||
serverNames.Add(urlutil.GetServerNamesForURL(policy.Source.URL)...)
|
||||
if policy.TLSDownstreamServerName != "" {
|
||||
tlsURL := policy.Source.URL.ResolveReference(&url.URL{Host: policy.TLSDownstreamServerName})
|
||||
serverNames.Add(urlutil.GetServerNamesForURL(tlsURL)...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return serverNames.ToSlice(), nil
|
||||
}
|
||||
|
||||
// GetClientSecret gets the client secret.
|
||||
func (o *Options) GetClientSecret() (string, error) {
|
||||
if o == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue