How to import a stylesheet from an environment file in Neo4j Docker

Viewed 39

I'm running Neo4j on docker and would like to import the style.grass file using an environment file. Below is the context of the env file:

NEO4J_browser_post__connect__cmd='style node {diameter: 50px;color: #A5ABB6;border-color: #9AA1AC;border-width: 2px;text-color-internal: #FFFFFF;font-size: 10px;}'

The errors I get are:

Unknown command :font-size: 10px
Unknown command :text-color-internal: #FFFFFF
Unknown command :border-width: 2px
Unknown command :border-color: #9AA1AC
Unknown command :color: #A5ABB6

So Neo4j is interpreting the attributes of the stylesheet as console commands. How can I change the environment file such that all the attributes in the stylesheet are interpreted correctly, so not as console commands. I have also tried NEO4J_browser_post__connect__cmd='style style.grass' but got the same errors. I can't fetch the stylesheet from an external link, so it has to be done internally.

1 Answers

The startup parameter in the neo4j.conf file is "browser.post_connect_cmd", not "NEO4J_browser_post__connect__cmd". I use this same parameter to automatically open browser guides on startup.

You could try removing the single quotes as well, and have:

browser.post_connect_cmd=style node {diameter: 50px;color: #A5ABB6;border-color: #9AA1AC;border-width: 2px;text-color-internal: #FFFFFF;font-size: 10px;}

I haven't tested it, but this should be equivalent to running the command manually:

:style node {
   diameter: 50px;
   color: #A5ABB6;
   border-color: #9AA1AC;
   border-width: 2px;
   text-color-internal: #FFFFFF;
   font-size: 10px;
}

I see similar discussions on this topic at https://github.com/neo4j/neo4j-browser/issues/171

Good luck.

Related