Skip to content

Commit

Permalink
Make the default namespace configurable
Browse files Browse the repository at this point in the history
This commit introduces a new vex.DefaultNamespace variable that is
used to set the namespace used in node and document identifiers. It
is set by default to the OpenVEX public namespace.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
  • Loading branch information
puerco committed Jul 14, 2023
1 parent deefc43 commit 831c0c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/vex/vex.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const (
errMsgParse = "error"
)

// DefaultNamespace is the URL that will be used to generate new IRIs for generated
// documents and nodes. It is set to the OpenVEX public namespace by default.
var DefaultNamespace = PublicNamespace

// The VEX type represents a VEX document and all of its contained information.
type VEX struct {
Metadata
Expand Down Expand Up @@ -386,7 +390,7 @@ func (vexDoc *VEX) GenerateCanonicalID() (string, error) {
}

// For common namespaced documents we namespace them into /public
vexDoc.ID = fmt.Sprintf("%s/public/vex-%s", PublicNamespace, cHash)
vexDoc.ID = fmt.Sprintf("%s/public/vex-%s", DefaultNamespace, cHash)
return vexDoc.ID, nil
}

Expand Down

0 comments on commit 831c0c4

Please sign in to comment.