]> src.bluestatic.org Git - armadillo.git/blob - src/config.go
Try to get the regex to work
[armadillo.git] / src / config.go
1 //
2 // Armadillo File Manager
3 // Copyright (c) 2010, Robert Sesek <http://www.bluestatic.org>
4 //
5 // This program is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free Software
7 // Foundation, either version 3 of the License, or any later version.
8 //
9
10 package config
11
12 import (
13 "json"
14 "os"
15 )
16
17 type Configuration struct {
18 // The path to which all file operations are restricted.
19 JailRoot string
20
21 // The port on which the server back end runs.
22 Port int
23
24 // An array of URLs that the /proxy service will for which the back-end will
25 // forward GET requests and return the result.
26 ProxyURLs []string
27
28 // A map of usernames to MD5-encoded passwords that will be allowed to log in
29 // via a .htaccess style realm.
30 Users map [string] string
31
32 // Whether to include dotfiles (files that begin with a '.'). Users will still
33 // be able to access directories that begin with a '.', but they will not be
34 // included in the list.
35 IncludeDotfiles bool
36 }
37
38 func ReadFromFile(aPath string, config *Configuration) os.Error {
39 fd, error := os.Open(aPath, os.O_RDONLY, 0)
40 if error != nil {
41 return error
42 }
43 decoder := json.NewDecoder(fd)
44 return decoder.Decode(config)
45 }