Skip to content

Commit

Permalink
Merge pull request #118 from noflo/default_graph_naming
Browse files Browse the repository at this point in the history
Default graph naming
  • Loading branch information
bergie committed Dec 1, 2018
2 parents ff16918 + 4f4bf33 commit 24bb01e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Base.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ class BaseTransport

if @options.defaultGraph?
@options.defaultGraph.baseDir = @options.baseDir
graphName = 'default/main'
graphName = @_getGraphName(@options.defaultGraph)
@context = 'none'
@graph.registerGraph graphName, @options.defaultGraph
@protocol.runtime.setMainGraph graphName, @options.defaultGraph
@network._startNetwork @options.defaultGraph, graphName, @context, (err) ->
throw err if err

Expand Down Expand Up @@ -54,6 +55,12 @@ class BaseTransport
unless @options.permissions
@options.permissions = {}

# Generate a name for the main graph
_getGraphName: (graph) ->
namespace = @options.namespace or 'default'
graphName = graph.name or 'main'
return "#{namespace}/#{graphName}"

# Check if a given user is authorized for a given capability
#
# @param [Array] Capabilities to check
Expand Down

0 comments on commit 24bb01e

Please sign in to comment.