Use autoconf-based paths from Haskell instead of constants
[ganeti-local] / htools / Ganeti / Path.hs
1 {-| Path-related helper functions.
2
3 -}
4
5 {-
6
7 Copyright (C) 2012 Google Inc.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 02110-1301, USA.
23
24 -}
25
26 module Ganeti.Path
27   ( defaultLuxiSocket
28   , defaultQuerySocket
29   , dataDir
30   , logDir
31   , runDir
32   , confdHmacKey
33   , clusterConfFile
34   ) where
35
36 import qualified Ganeti.Constants as C
37 import System.FilePath
38
39
40 -- | Directory for data
41 dataDir :: FilePath
42 dataDir = C.autoconfLocalstatedir </> "lib" </> "ganeti"
43
44 -- | Directory for runtime files
45 runDir :: FilePath
46 runDir = C.autoconfLocalstatedir </> "run" </> "ganeti"
47
48 -- | Directory for log files
49 logDir :: FilePath
50 logDir = C.autoconfLocalstatedir </> "log" </> "ganeti"
51
52 -- | Directory for Unix sockets
53 socketDir :: FilePath
54 socketDir = runDir </> "socket"
55
56 -- | The default LUXI socket path.
57 defaultLuxiSocket :: FilePath
58 defaultLuxiSocket = socketDir </> "ganeti-master"
59
60 -- | The default LUXI socket for queries.
61 defaultQuerySocket :: FilePath
62 defaultQuerySocket = socketDir </> "ganeti-query"
63
64 -- | Path to file containing confd's HMAC key
65 confdHmacKey :: FilePath
66 confdHmacKey = dataDir </> "hmac.key"
67
68 -- | Path to cluster configuration file
69 clusterConfFile :: FilePath
70 clusterConfFile  = dataDir </> "config.data"