mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-24 13:38:17 +02:00
assets: use embed instead of statik (#1960)
* assets: use embed instead of statik * remove empty line * maybe fix precommit
This commit is contained in:
parent
92c3a4a56c
commit
b6ec01f377
15 changed files with 78 additions and 125 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue