Ejemplo n.º 1
0
func setup() (uri *url.URL, f *os.File, err error) {
	runtime.GOMAXPROCS(runtime.NumCPU())

	if !AllowAuthFromFiles || CredentialsPath == "" {
		aa.LoadCredentials(inlineCredentials)
	} else if err = aa.LoadCredentials(CredentialsPath); err != nil {
		return
	}

	if !AllowAuthFromFiles || AuthorizationsPath == "" {
		az.LoadAuthorizations(inlineAuthorizations)
	} else if err = az.LoadAuthorizations(AuthorizationsPath); err != nil {
		return
	}

	uri, err = url.Parse(BackendURL)
	if err != nil {
		return
	}

	f, err = redirectLogsToFile(LogPath)
	return
}
func loadAuthorizations() {
	az.LoadAuthorizations(az.AuthorizationStore{
		"foo": az.AuthorizationRules{DefaultRule: az.Allow, Rules: []string{"GET /_cluster/health"}},
		"baz": az.AuthorizationRules{DefaultRule: az.Deny, Rules: []string{"GET /_cluster/health"}},
	})
}