mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-01 01:52:18 +01:00
Refactor database configuration.
- don't repeat config-db.php file path - add @is_readable, we might not have the proper permissions. - use 'require_once' instead of 'include', this file should only be included once and we should fail dramatically if we can't load it. - better documentation.
This commit is contained in:
parent
7e76f9bff8
commit
4ca6fb5448
@ -27,10 +27,16 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// ykval will use the configuration stored in /etc/yubico/val/config-db.php, if that file exists. If it does not exist, the below values will be used.
|
||||
if (file_exists('/etc/yubico/val/config-db.php'))
|
||||
|
||||
/**
|
||||
* Load database configuration settings from config-db.php if available,
|
||||
* otherwise default to values specified below.
|
||||
*/
|
||||
$dbfile = '/etc/yubico/val/config-db.php';
|
||||
|
||||
if (file_exists($dbfile) && @is_readable($dbfile))
|
||||
{
|
||||
include '/etc/yubico/val/config-db.php';
|
||||
require_once $dbfile;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user