Cole-Greer commented on code in PR #3384:
URL: https://github.com/apache/tinkerpop/pull/3384#discussion_r3095098562


##########
docs/src/reference/gremlin-applications.asciidoc:
##########
@@ -469,31 +469,83 @@ That file tells Gremlin Server many things such as:
 * Thread pool sizes
 * Where to report metrics gathered by the server
 * The serializers to make available
-* The Gremlin `ScriptEngine` instances to expose and external dependencies to 
inject into them
 * `Graph` instances to expose
+* `TraversalSource` bindings (auto-created or explicitly declared)
+* `LifeCycleHook` implementations for startup/shutdown logic
 
 The log messages that printed above show a number of things, but most 
importantly, there is a `Graph` instance named
 `graph` that is exposed in Gremlin Server.  This graph is an in-memory 
TinkerGraph and was empty at the start of the
-server.  An initialization script at `scripts/generate-modern.groovy` was 
executed during startup.  Its contents are
-as follows:
+server.  A `TinkerFactoryDataLoader` lifecycle hook loaded the "modern" 
dataset into it during startup, and a
+`TraversalSource` named `g` was auto-created from the `graph` entry.
 
-[source,groovy]
+[[server-auto-traversal-sources]]
+==== Auto-Created TraversalSources
+
+When Gremlin Server starts, it automatically creates a `TraversalSource` for 
each graph in the `graphs` configuration
+that does not have an explicit entry in the `traversalSources` section.  The 
naming convention is:
+
+* A graph named `graph` gets a `TraversalSource` named `g`
+* All other graphs get `g_<name>` (e.g. a graph named `modern` gets `g_modern`)
+
+This means a minimal configuration like the following is fully functional:
+
+[source,yaml]
+----
+graphs: {
+  graph: conf/tinkergraph-empty.properties}
+----
+
+[[server-traversal-sources]]
+==== Declarative TraversalSources
+
+For more control, the `traversalSources` YAML section allows explicit 
`TraversalSource` creation with optional
+strategy configuration via a Gremlin query:
+
+[source,yaml]
+----
+traversalSources: {
+  g: {graph: graph},
+  gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)", 
language: "gremlin-lang"}}

Review Comment:
   I'll change it to "gremlinExpression".
   
   The only control that currently exists is whatever the script engine outputs 
from that "gremlinExpression" must be castable to `TraversalSource`. I believe 
that should block most accidental misuse, without really restricting any 
legitimate configuration.
   
   I'm personally not as worried about additional enforced restrictions. My 
assumption is anyone with access to the server config is already a trusted 
individual. The ability to run a gremlin query during traversal source 
initialization is already a much weaker tool than the groovy init scripts of 
old.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to