assets: use embed instead of statik (#1960)

* assets: use embed instead of statik

* remove empty line

* maybe fix precommit
This commit is contained in:
Caleb Doxsey 2021-03-03 18:56:55 -07:00 committed by GitHub
parent 92c3a4a56c
commit b6ec01f377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 78 additions and 125 deletions

View file

@ -4,12 +4,10 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
lru "github.com/hashicorp/golang-lru"
"github.com/rakyll/statik/fs"
_ "github.com/pomerium/pomerium/authorize/evaluator/opa/policy" // load static assets
"github.com/pomerium/pomerium/authorize/evaluator/opa"
"github.com/pomerium/pomerium/internal/log"
)
@ -67,17 +65,6 @@ func parseCertificate(pemStr string) (*x509.Certificate, error) {
return x509.ParseCertificate(block.Bytes)
}
const statikNamespace = "rego"
func readPolicy(fn string) ([]byte, error) {
statikFS, err := fs.NewWithNamespace(statikNamespace)
if err != nil {
return nil, err
}
r, err := statikFS.Open(fn)
if err != nil {
return nil, err
}
defer r.Close()
return ioutil.ReadAll(r)
func readPolicy() ([]byte, error) {
return opa.FS.ReadFile("policy/authz.rego")
}