diff --git a/gapi/gapi.go b/gapi/gapi.go index 95f9d115..09b45f6f 100644 --- a/gapi/gapi.go +++ b/gapi/gapi.go @@ -50,6 +50,7 @@ type Data struct { Noop bool NoConfigWatch bool NoStreamWatch bool + Prefix string Debug bool Logf func(format string, v ...interface{}) // NOTE: we can add more fields here if needed by GAPI endpoints diff --git a/lang/interpolate.go b/lang/interpolate.go index 32aa923d..5690fcf2 100644 --- a/lang/interpolate.go +++ b/lang/interpolate.go @@ -38,6 +38,9 @@ type Pos struct { // InterpolateInfo contains some information passed around during interpolation. // TODO: rename to Info if this is moved to its own package. type InterpolateInfo struct { + // Prefix used for path namespacing if required. + Prefix string + // Debug represents if we're running in debug mode or not. Debug bool @@ -73,7 +76,8 @@ func InterpolateStr(str string, pos *Pos, info *InterpolateInfo) (interfaces.Exp } transformInfo := &InterpolateInfo{ - Debug: info.Debug, + Prefix: info.Prefix, + Debug: info.Debug, Logf: func(format string, v ...interface{}) { info.Logf("transform: "+format, v...) }, diff --git a/lang/lang.go b/lang/lang.go index 83cccc49..08caa5d9 100644 --- a/lang/lang.go +++ b/lang/lang.go @@ -47,6 +47,7 @@ type Lang struct { Input io.Reader // os.Stdin or anything that satisfies this interface Hostname string World engine.World + Prefix string Debug bool Logf func(format string, v ...interface{}) diff --git a/lib/main.go b/lib/main.go index c5f32516..c9c0afb1 100644 --- a/lib/main.go +++ b/lib/main.go @@ -481,6 +481,7 @@ func (obj *Main) Run() error { //NoWatch: obj.NoWatch, NoConfigWatch: obj.NoConfigWatch, NoStreamWatch: obj.NoStreamWatch, + Prefix: fmt.Sprintf("%s/", path.Join(prefix, "gapi")), Debug: obj.Flags.Debug, Logf: func(format string, v ...interface{}) { log.Printf("gapi: "+format, v...)