180 lines
4.4 KiB
C++
Executable File
180 lines
4.4 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfilecmslucoreconfig
|
|
#define headerfilecmslucoreconfig
|
|
|
|
#include <string>
|
|
#include "confparser.h"
|
|
|
|
|
|
|
|
|
|
class Config
|
|
{
|
|
public:
|
|
|
|
// name of the config file (full path can be)
|
|
std::string config_file;
|
|
|
|
// log file name, log file name for notifications (sending emails, etc)
|
|
std::string log_file, log_notify_file;
|
|
|
|
// 1 - minimum
|
|
// 2 - (default)
|
|
// 3 - maximum - all logs
|
|
int log_level;
|
|
|
|
// logging to stdout too
|
|
bool log_stdout;
|
|
|
|
// how many requests should be logged in the same time
|
|
// default: 1
|
|
int log_request;
|
|
|
|
// fast cgi: socket (unix domain)
|
|
std::string fcgi_socket;
|
|
|
|
// fast cgi: socket permissions
|
|
int fcgi_socket_chmod;
|
|
|
|
// fast cgi: owner of the socket
|
|
std::string fcgi_socket_user;
|
|
|
|
// fast cgi: group of the socket
|
|
std::string fcgi_socket_group;
|
|
|
|
std::string templates_dir;
|
|
std::string templates_dir_default; // templates from winix
|
|
|
|
std::string db_database;
|
|
std::string db_user;
|
|
std::string db_pass;
|
|
|
|
std::string http_session_id_name;
|
|
|
|
// when the HOST_HTTP environment variable doesn't point into 'base_url' (the part 'http://' and the last slash is removed)
|
|
// the server will redirect into 'base_url' + 'REQUEST_URI'
|
|
// it's useful when you want to redirect from 'mydomain.tld' into 'www.mydomain.tld' etc.
|
|
bool base_url_redirect;
|
|
|
|
// string used in a place where is a user (or group) selected
|
|
std::string priv_no_user;
|
|
std::string priv_no_group;
|
|
|
|
// time in seconds when the user will be automatically logged out (iddle time)
|
|
int session_max_idle;
|
|
|
|
// time in seconds when the user will be automatically logged out (when he selected 'remember me' option)
|
|
// this time is usually greater than session_max_idle
|
|
int session_remember_max_idle;
|
|
|
|
// this file is used when the program is starting and ending
|
|
std::string session_file;
|
|
|
|
// allow the html ouput to be compressed
|
|
bool compression;
|
|
|
|
// plugins
|
|
std::vector<std::string> plugin_file;
|
|
|
|
// the html code is cleaned by our filter
|
|
bool html_filter;
|
|
|
|
// the url of a new empty item (if there is not the subject too)
|
|
std::string item_url_empty;
|
|
|
|
// maximum length of a file send by post multipart form
|
|
// 0 - not used
|
|
int post_file_max;
|
|
|
|
// directories for static files
|
|
std::string auth_simplefs_dir;
|
|
std::string auth_hashfs_dir;
|
|
|
|
// temporary directory for static content used by the upload function
|
|
// should be on the same partition as auth_simplefs_dir and auth_hashfs_dir
|
|
std::string auth_tmp_dir;
|
|
|
|
// default locale: en pl
|
|
std::string locale_str;
|
|
|
|
// directory with locale files
|
|
std::string locale_dir;
|
|
|
|
// directory with default locale files (those from winix)
|
|
std::string locale_dir_default;
|
|
|
|
// the main address of the server (e.g. someserver.com) (without the 'www' part etc)
|
|
std::string base_server;
|
|
|
|
// the main address of the site (e.g. http://www.someserver.com)
|
|
std::string base_url;
|
|
|
|
// static content authorized by winix
|
|
std::string base_url_auth;
|
|
|
|
// static content not authorized by winix
|
|
std::string base_url_static;
|
|
|
|
// additional static server for common content (not authorized)
|
|
std::string base_url_common;
|
|
|
|
// separator used in <title> html tag
|
|
std::string title_separator;
|
|
|
|
|
|
// based on base_url
|
|
// set by SetAdditionalVariables()
|
|
// without the first part http:// (or https://) or the whole string is empty
|
|
std::string base_url_http_host;
|
|
std::string base_url_auth_http_host;
|
|
|
|
|
|
Config();
|
|
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);
|
|
|
|
std::string Text(const char * name);
|
|
std::string Text(const char * name, const char * def);
|
|
std::string Text(const std::string & name, const std::string & def);
|
|
int Int(const char *);
|
|
int Int(const char * name, int def);
|
|
int Int(const std::string & name, int def);
|
|
bool Bool(const char *);
|
|
bool Bool(const char * name, bool def);
|
|
bool Bool(const std::string & name, bool def);
|
|
void ListText(const char * name, std::vector<std::string> & list);
|
|
void ListText(const std::string & name, std::vector<std::string> & list);
|
|
|
|
void NoLastSlash(std::string & s);
|
|
void NoFirstHttp(std::string & s);
|
|
|
|
private:
|
|
void ShowError();
|
|
void AssignValues(bool stdout_is_closed);
|
|
void SetHttpHost(const std::string & in, std::string & out);
|
|
void SetAdditionalVariables();
|
|
|
|
ConfParser parser;
|
|
|
|
std::string default_str;
|
|
int default_int;
|
|
bool default_bool;
|
|
|
|
bool errors_to_stdout;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|