Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Feeds
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Feeds
Commits
383f4ca0
Commit
383f4ca0
authored
4 years ago
by
Andrew Dolgov
Browse files
Options
Downloads
Patches
Plain Diff
add config.php
parent
e4107ac9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
classes/config.php
+98
-0
98 additions, 0 deletions
classes/config.php
with
99 additions
and
1 deletion
.gitignore
+
1
−
1
View file @
383f4ca0
...
...
@@ -11,7 +11,7 @@ Thumbs.db
.idea/*
plugins.local/*
themes.local/*
config.php
/
config.php
feed-icons/*
cache/*/*
lock/*
...
...
This diff is collapsed.
Click to expand it.
classes/config.php
0 → 100644
+
98
−
0
View file @
383f4ca0
<?php
class
Config
{
const
DB_TYPE
=
"DB_TYPE"
;
const
DB_HOST
=
"DB_HOST"
;
const
DB_USER
=
"DB_USER"
;
const
DB_NAME
=
"DB_NAME"
;
const
DB_PASS
=
"DB_PASS"
;
const
DB_PORT
=
"DB_PORT"
;
const
MYSQL_CHARSET
=
"MYSQL_CHARSET"
;
const
SELF_URL_PATH
=
"SELF_URL_PATH"
;
const
SINGLE_USER_MODE
=
"SINGLE_USER_MODE"
;
const
SIMPLE_UPDATE_MODE
=
"SIMPLE_UPDATE_MODE"
;
const
PHP_EXECUTABLE
=
"PHP_EXECUTABLE"
;
const
LOCK_DIRECTORY
=
"LOCK_DIRECTORY"
;
const
CACHE_DIR
=
"CACHE_DIR"
;
const
ICONS_DIR
=
"ICONS_DIR"
;
const
ICONS_URL
=
"ICONS_URL"
;
const
AUTH_AUTO_CREATE
=
"AUTH_AUTO_CREATE"
;
const
AUTH_AUTO_LOGIN
=
"AUTH_AUTO_LOGIN"
;
const
FORCE_ARTICLE_PURGE
=
"FORCE_ARTICLE_PURGE"
;
const
ENABLE_REGISTRATION
=
"ENABLE_REGISTRATION"
;
const
SESSION_COOKIE_LIFETIME
=
"SESSION_COOKIE_LIFETIME"
;
const
SMTP_FROM_NAME
=
"SMTP_FROM_NAME"
;
const
SMTP_FROM_ADDRESS
=
"SMTP_FROM_ADDRESS"
;
const
DIGEST_SUBJECT
=
"DIGEST_SUBJECT"
;
const
CHECK_FOR_UPDATES
=
"CHECK_FOR_UPDATES"
;
const
PLUGINS
=
"PLUGINS"
;
const
LOG_DESTINATION
=
"LOG_DESTINATION"
;
private
const
_DEFAULTS
=
[
Config
::
DB_TYPE
=>
"pgsql"
,
Config
::
DB_HOST
=>
"db"
,
Config
::
DB_USER
=>
""
,
Config
::
DB_NAME
=>
""
,
Config
::
DB_PASS
=>
""
,
Config
::
DB_PORT
=>
"5432"
,
Config
::
MYSQL_CHARSET
=>
"UTF8"
,
Config
::
SELF_URL_PATH
=>
""
,
Config
::
SINGLE_USER_MODE
=>
""
,
Config
::
SIMPLE_UPDATE_MODE
=>
""
,
Config
::
PHP_EXECUTABLE
=>
"/usr/bin/php"
,
Config
::
LOCK_DIRECTORY
=>
"lock"
,
Config
::
CACHE_DIR
=>
"cache"
,
Config
::
ICONS_DIR
=>
"feed-icons"
,
Config
::
ICONS_URL
=>
"feed-icons"
,
Config
::
AUTH_AUTO_CREATE
=>
"true"
,
Config
::
AUTH_AUTO_LOGIN
=>
"true"
,
Config
::
FORCE_ARTICLE_PURGE
=>
0
,
Config
::
ENABLE_REGISTRATION
=>
""
,
Config
::
SESSION_COOKIE_LIFETIME
=>
86400
,
Config
::
SMTP_FROM_NAME
=>
"Tiny Tiny RSS"
,
Config
::
SMTP_FROM_ADDRESS
=>
"noreply@localhost"
,
Config
::
DIGEST_SUBJECT
=>
"[tt-rss] New headlines for last 24 hours"
,
Config
::
CHECK_FOR_UPDATES
=>
"true"
,
Config
::
PLUGINS
=>
"auth_internal"
,
Config
::
LOG_DESTINATION
=>
"sql"
,
];
private
const
_ENVVAR_PREFIX
=
"TTRSS_"
;
private
static
$instance
;
private
$params
=
[];
public
static
function
get_instance
()
{
if
(
self
::
$instance
==
null
)
self
::
$instance
=
new
self
();
return
self
::
$instance
;
}
function
__construct
()
{
$ref
=
new
ReflectionClass
(
get_class
(
$this
));
foreach
(
$ref
->
getConstants
()
as
$const
=>
$cvalue
)
{
if
(
strpos
(
$const
,
"_"
)
!==
0
)
{
$override
=
getenv
(
$this
::
_ENVVAR_PREFIX
.
$const
);
if
(
!
empty
(
$override
))
{
$this
->
params
[
$cvalue
]
=
$override
;
}
else
{
$this
->
params
[
$cvalue
]
=
$this
::
_DEFAULTS
[
$const
];
}
}
}
}
private
function
_get
(
$param
)
{
return
$this
->
params
[
$param
];
}
static
function
get
(
$param
)
{
$instance
=
self
::
get_instance
();
return
$instance
->
_get
(
$param
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment