Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
1e2027a9
Commit
1e2027a9
authored
Jul 04, 2016
by
Dylan William Hardison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1284263 - Add optional support for $DATABASE_URL instead of localconfig for…
Bug 1284263 - Add optional support for $DATABASE_URL instead of localconfig for db_* connection params.
parent
c61b7ce7
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
5 deletions
+65
-5
Localconfig.pm
Bugzilla/Install/Localconfig.pm
+28
-1
META.json
META.json
+13
-2
META.yml
META.yml
+6
-1
Makefile.PL
Makefile.PL
+8
-0
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+5
-1
strings.txt.pl
template/en/default/setup/strings.txt.pl
+5
-0
No files found.
Bugzilla/Install/Localconfig.pm
View file @
1e2027a9
...
...
@@ -60,6 +60,10 @@ use constant LOCALCONFIG_VARS => (
default
=>
0
,
},
{
name
=>
'db_from_env'
,
default
=>
0
,
},
{
name
=>
'db_driver'
,
default
=>
'sqlite'
,
},
...
...
@@ -198,6 +202,25 @@ sub read_localconfig {
}
}
}
require
Bugzilla::
Error
;
if
(
$localconfig
{
db_from_env
})
{
if
(
Bugzilla
->
has_feature
(
'db_from_env'
))
{
require
URI::
db
;
unless
(
$ENV
{
DATABASE_URL
})
{
Bugzilla::Error::
ThrowUserError
(
'missing_database_url'
);
}
my
$uri
=
URI::
db
->
new
(
$ENV
{
DATABASE_URL
});
$localconfig
{
db_driver
}
=
$uri
->
canonical_engine
;
$localconfig
{
db_name
}
=
$uri
->
dbname
;
$localconfig
{
db_host
}
=
$uri
->
host
;
$localconfig
{
db_user
}
=
$uri
->
user
;
$localconfig
{
db_pass
}
=
$uri
->
password
;
$localconfig
{
db_port
}
=
$uri
->
port
//
0
;
}
else
{
Bugzilla::Error::
ThrowUserError
(
'feature_disabled'
,
{
feature
=>
'db_from_env'
});
}
}
return
\%
localconfig
;
}
...
...
@@ -233,6 +256,7 @@ sub update_localconfig {
my
$output
=
$params
->
{
output
}
||
0
;
my
$answer
=
Bugzilla
->
installation_answers
;
my
$localconfig
=
read_localconfig
(
'include deprecated'
);
my
$db_from_env
=
Bugzilla
->
localconfig
->
{
db_from_env
};
my
@new_vars
;
foreach
my
$var
(
LOCALCONFIG_VARS
)
{
...
...
@@ -258,7 +282,7 @@ sub update_localconfig {
# an answer file, then we don't notify about site_wide_secret
# because we assume the intent was to auto-generate it anyway.
if
(
!
scalar
(
keys
%
$answer
)
||
$name
ne
'site_wide_secret'
)
{
push
(
@new_vars
,
$name
);
push
(
@new_vars
,
$name
)
unless
$db_from_env
&&
$name
=~
/^db_(?!from_env)/
;
}
$localconfig
->
{
$name
}
=
$var
->
{
default
};
}
...
...
@@ -298,6 +322,9 @@ sub update_localconfig {
foreach
my
$var
(
LOCALCONFIG_VARS
)
{
my
$name
=
$var
->
{
name
};
my
$desc
=
$var
->
{
desc
};
next
if
$db_from_env
&&
$name
=~
/^db_(?!from_env)/
;
if
(
!
length
$desc
){
$desc
=
install_string
(
"localconfig_$name"
,
{
root
=>
ROOT_USER
});
chomp
(
$desc
);
...
...
META.json
View file @
1e2027a9
...
...
@@ -4,7 +4,7 @@
"Bugzilla Developers <developers@bugzilla.org>"
],
"dynamic_config"
:
1
,
"generated_by"
:
"ExtUtils::MakeMaker version 7.
18, CPAN::Meta::Converter version 2.143240
"
,
"generated_by"
:
"ExtUtils::MakeMaker version 7.
24, CPAN::Meta::Converter version 2.150005
"
,
"license"
:
[
"unknown"
],
...
...
@@ -61,6 +61,16 @@
}
}
},
"db_from_env"
:
{
"description"
:
"Support for using $ENV{DATABASE_URL}"
,
"prereqs"
:
{
"runtime"
:
{
"requires"
:
{
"URI::db"
:
"0.17"
}
}
}
},
"detect_charset"
:
{
"description"
:
"Automatic charset detection for text attachments"
,
"prereqs"
:
{
...
...
@@ -387,5 +397,6 @@
}
},
"release_status"
:
"stable"
,
"version"
:
"v5.1.1+"
"version"
:
"v5.1.1+"
,
"x_serialization_backend"
:
"JSON::PP version 2.27300"
}
META.yml
View file @
1e2027a9
...
...
@@ -12,7 +12,7 @@ build_requires:
configure_requires
:
ExtUtils::MakeMaker
:
'
6.55'
dynamic_config
:
1
generated_by
:
'
ExtUtils::MakeMaker
version
7.
18,
CPAN::Meta::Converter
version
2.143240
'
generated_by
:
'
ExtUtils::MakeMaker
version
7.
24,
CPAN::Meta::Converter
version
2.150005
'
license
:
unknown
meta-spec
:
url
:
http://module-build.sourceforge.net/META-spec-v1.4.html
...
...
@@ -40,6 +40,10 @@ optional_features:
requires
:
MooX::StrictConstructor
:
'
0.008'
Type::Tiny
:
'
1'
db_from_env
:
description
:
'
Support
for
using
$ENV{DATABASE_URL}'
requires
:
URI::db
:
'
0.17'
detect_charset
:
description
:
'
Automatic
charset
detection
for
text
attachments'
requires
:
...
...
@@ -190,3 +194,4 @@ requires:
URI
:
'
1.55'
perl
:
'
5.014000'
version
:
v5.1.1+
x_serialization_backend
:
'
CPAN::Meta::YAML
version
0.018'
Makefile.PL
View file @
1e2027a9
...
...
@@ -298,6 +298,14 @@ my %optional_features = (
}
}
},
db_from_env
=>
{
description
=>
'Support for using $ENV{DATABASE_URL}'
,
prereqs
=>
{
runtime
=>
{
requires
=>
{
'URI::db'
=>
'0.17'
},
},
},
},
);
for
my
$file
(
glob
(
"extensions/*/Config.pm"
)
)
{
...
...
template/en/default/global/user-error.html.tmpl
View file @
1e2027a9
...
...
@@ -566,7 +566,7 @@
[% ELSIF error == "feature_disabled" %]
The [% feature_description(feature) FILTER html %] feature is not available in this Bugzilla.
[% IF user.in_group('admin') %]
[% IF user.in_group('admin')
|| Bugzilla.usage_mode != constants.USAGE_MODE_BROWSER
%]
If you would like to enable this feature, please run
<kbd>cpanm -l local --installdeps --with-feature [% feature FILTER html %] "."</kbd>
[% END %]
...
...
@@ -1350,6 +1350,10 @@
the results of your last search. I'm afraid you will have to start
again from the <a href="query.cgi">search page</a>.
[% ELSIF error == "missing_database_url" %]
[% title = "Missing \$DATABASE_URL" %]
$DATABASE_URL must be defined when localconfig "db_from_env" option is enabled.
[% ELSIF error == "missing_datasets" %]
[% title = "No Datasets Selected" %]
[% docslinks = {'using/reports-and-charts.html' => 'Reporting'} %]
...
...
template/en/default/setup/strings.txt.pl
View file @
1e2027a9
...
...
@@ -129,6 +129,11 @@ With some combinations of database servers/Perl modules/moonphase this
doesn'
t
work
,
and
so
you
can
try
setting
this
to
0
to
make
checksetup
.
pl
run
.
END
localconfig_db_from_env
=>
<<
'END'
,
If
this
is
set
,
the
other
db_
*
values
will
be
ignored
and
instead
the
$DATABASE_URL
will
be
used
to
provide
the
database
connection
information
.
Note
this
requires
the
'db_from_env'
feature
to
be
enabled
.
END
localconfig_db_driver
=>
<<
'END'
,
What
SQL
database
to
use
.
Default
is
mysql
.
List
of
supported
databases
can
be
obtained
by
listing
Bugzilla
/
DB
directory
-
every
module
corresponds
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment