From 61c32da456046f1aacab4b6fc330a3887ea3b4c4 Mon Sep 17 00:00:00 2001
From: Guillem Jover <gjover@sipwise.com>
Date: Fri, 17 Aug 2018 17:25:50 +0200
Subject: [PATCH 4/5] influxd: Change default unix socket path

This makes it easier to run influxdb as an unprivileged user.
---
 etc/config.sample.toml        | 2 +-
 services/httpd/config.go      | 2 +-
 services/httpd/config_test.go | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/etc/config.sample.toml b/etc/config.sample.toml
index f874cb4a8..a410adaaa 100644
--- a/etc/config.sample.toml
+++ b/etc/config.sample.toml
@@ -250,7 +250,7 @@
   # unix-socket-enabled = false
 
   # The path of the unix domain socket.
-  # bind-socket = "/var/run/influxdb.sock"
+  # bind-socket = "/run/influxdb/influxdb.sock"
 
 ###
 ### [subscriber]
diff --git a/services/httpd/config.go b/services/httpd/config.go
index 67b711e18..2db09a524 100644
--- a/services/httpd/config.go
+++ b/services/httpd/config.go
@@ -8,7 +8,7 @@ const (
 	DefaultRealm = "InfluxDB"
 
 	// DefaultBindSocket is the default unix socket to bind to.
-	DefaultBindSocket = "/var/run/influxdb.sock"
+	DefaultBindSocket = "/run/influxdb/influxdb.sock"
 )
 
 // Config represents a configuration for a HTTP service.
diff --git a/services/httpd/config_test.go b/services/httpd/config_test.go
index 38f1bc223..f34e2e86d 100644
--- a/services/httpd/config_test.go
+++ b/services/httpd/config_test.go
@@ -19,7 +19,7 @@ write-tracing = true
 https-enabled = true
 https-certificate = "/dev/null"
 unix-socket-enabled = true
-bind-socket = "/var/run/influxdb.sock"
+bind-socket = "/run/influxdb/influxdb.sock"
 `, &c); err != nil {
 		t.Fatal(err)
 	}
@@ -41,7 +41,7 @@ bind-socket = "/var/run/influxdb.sock"
 		t.Fatalf("unexpected https certificate: %v", c.HTTPSCertificate)
 	} else if c.UnixSocketEnabled != true {
 		t.Fatalf("unexpected unix socket enabled: %v", c.UnixSocketEnabled)
-	} else if c.BindSocket != "/var/run/influxdb.sock" {
+	} else if c.BindSocket != "/run/influxdb/influxdb.sock" {
 		t.Fatalf("unexpected bind unix socket: %v", c.BindSocket)
 	}
 }
-- 
2.18.0

