Module: Neo4j::Tasks::ConfigServer
Instance Method Summary collapse
-
#change_password(target_address, old_password, new_password) ⇒ Hash
POSTs to an endpoint with the form required to change a Neo4j password.
- #config(source_text, port) ⇒ Object
- #set_property(source_text, property, value) ⇒ Object
-
#toggle_auth(status, source_text) ⇒ Object
Toggles the status of Neo4j 2.2’s basic auth.
Instance Method Details
#change_password(target_address, old_password, new_password) ⇒ Hash
POSTs to an endpoint with the form required to change a Neo4j password
24 25 26 27 28 |
# File 'lib/neo4j/tasks/config_server.rb', line 24 def change_password(target_address, old_password, new_password) uri = URI.parse("#{target_address}/user/neo4j/password") response = Net::HTTP.post_form(uri, 'password' => old_password, 'new_password' => new_password) JSON.parse(response.body) end |
#config(source_text, port) ⇒ Object
4 5 6 7 |
# File 'lib/neo4j/tasks/config_server.rb', line 4 def config(source_text, port) s = set_property(source_text, 'org.neo4j.server.webserver.https.enabled', 'false') set_property(s, 'org.neo4j.server.webserver.port', port) end |
#set_property(source_text, property, value) ⇒ Object
9 10 11 |
# File 'lib/neo4j/tasks/config_server.rb', line 9 def set_property(source_text, property, value) source_text.gsub(/#{property}\s*=\s*(\w+)/, "#{property}=#{value}") end |
#toggle_auth(status, source_text) ⇒ Object
Toggles the status of Neo4j 2.2’s basic auth
14 15 16 17 |
# File 'lib/neo4j/tasks/config_server.rb', line 14 def toggle_auth(status, source_text) status_string = status == :enable ? 'true' : 'false' set_property(source_text, 'dbms.security.authorization_enabled', status_string) end |