support loading contexts from a filename
nats --context /some/file.json will use that file if accessible
else use the existing behavior.
@@ -759,7 +759,13 @@ func loadContext() error {
var err error
+ exist, _ := fileAccessible(opts.CfgCtx)
+
+ if exist {
+ opts.Config, err = natscontext.NewFromFile(opts.CfgCtx, ctxOpts...)
+ } else {
opts.Config, err = natscontext.New(opts.CfgCtx, !SkipContexts, ctxOpts...)
+ }
return err
}
