2 * rs-serve - (c) 2013 Niklas E. Cathor
4 * This program is distributed in the hope that it will be useful,
5 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 * GNU Affero General Public License for more details.
9 * You should have received a copy of the GNU Affero General Public License
10 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * This file contains configuration options and other constants that don't
20 * change after the server process has been started. Some of the values are
21 * compile-time constants, others can be changed through command-line flags
22 * or are detected during startup.
24 * All variables within this file declared at "extern" are defined and
25 * initialized in "config.c", which also evaluates command line arguments.
27 * All code outside this file and config.c only accesses these values via
28 * their uppercase (RS_*) variant, so if you want to turn any of the mutable
29 * options into compile-time constants, you can do so via this file.
33 // address & port to bind to
34 #define RS_ADDRESS "0.0.0.0"
36 #define RS_PORT rs_port
38 // (exception: rs_event_base is defined in main.c)
39 extern struct event_base *rs_event_base;
40 #define RS_EVENT_BASE rs_event_base
42 // only used for webfinger result at the moment
43 extern char *rs_scheme;
44 #define RS_SCHEME rs_scheme
45 extern char *rs_hostname;
46 #define RS_HOSTNAME rs_hostname
47 #define RS_STORAGE_API "draft-dejong-remotestorage-01"
48 #define RS_AUTH_METHOD "http://tools.ietf.org/html/rfc6749#section-4.2"
50 extern char *rs_auth_uri;
51 #define RS_AUTH_URI rs_auth_uri
52 extern int rs_auth_uri_len;
53 #define RS_AUTH_URI_LEN rs_auth_uri_len
55 extern int rs_webfinger_enabled;
56 #define RS_WEBFINGER_ENABLED rs_webfinger_enabled
58 // magic database file to use (NULL indicates system default)
59 #define RS_MAGIC_DATABASE NULL
62 #define RS_ALLOW_ORIGIN "*"
63 #define RS_ALLOW_HEADERS "Authorization, Content-Type, If-Match, If-None-Match, Origin"
64 #define RS_ALLOW_METHODS "HEAD, GET, PUT, DELETE"
65 #define RS_EXPOSE_HEADERS "Content-Type, Content-Length, ETag"
67 // permissions for newly created files
68 #define RS_FILE_CREATE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
71 extern FILE *rs_log_file;
72 #define RS_LOG_FILE rs_log_file
75 extern FILE *rs_pid_file;
76 #define RS_PID_FILE rs_pid_file
77 extern char *rs_pid_file_path;
78 #define RS_PID_FILE_PATH rs_pid_file_path
82 #define RS_DETACH rs_detach
84 extern char *rs_home_serve_root;
85 #define RS_HOME_SERVE_ROOT rs_home_serve_root
86 extern int rs_home_serve_root_len;
87 #define RS_HOME_SERVE_ROOT_LEN rs_home_serve_root_len
89 extern char *rs_static_dir;
90 #define RS_STATIC_DIR rs_static_dir
91 extern int rs_static_dir_len;
92 #define RS_STATIC_DIR_LEN rs_static_dir_len
94 extern struct rs_header rs_default_headers;
95 #define RS_DEFAULT_HEADERS rs_default_headers
97 #define RS_MIN_UID 1000
99 //#define RS_AUTH_DB_PATH "/var/lib/rs-serve/authorizations"
100 //#define RS_META_DB_PATH "/var/lib/rs-serve/meta"
101 #define RS_AUTH_DB_PATH "var/authorizations"
102 #define RS_META_DB_PATH "var/meta"
104 extern int rs_use_xattr;
105 #define RS_USE_XATTR rs_use_xattr
107 extern int rs_experimental;
108 #define RS_EXPERIMENTAL rs_experimental
110 extern int rs_use_ssl;
111 #define RS_USE_SSL rs_use_ssl
112 extern char *rs_ssl_cert_path;
113 #define RS_SSL_CERT_PATH rs_ssl_cert_path
114 extern char *rs_ssl_key_path;
115 #define RS_SSL_KEY_PATH rs_ssl_key_path
116 extern char *rs_ssl_ca_path;
117 #define RS_SSL_CA_PATH rs_ssl_ca_path
119 void init_config(int argc, char **argv);
120 void cleanup_config(void);
122 #endif /* !RS_CONFIG_H */