Skip to content

Commit

Permalink
API Call Limiter is now enabled by default and fixed some env variabl…
Browse files Browse the repository at this point in the history
…es for shared hosting
  • Loading branch information
zigazajc007 committed Feb 1, 2023
1 parent 80aeddd commit 33c817f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "passky-server",
"description": "Server for Passky (password manager)",
"version": "8.1.1",
"version": "8.1.2",
"main": "tailwind.config.js",
"scripts": {
"build": "npx tailwindcss -i ./tailwind.css -o ./server/src/website/css/tailwind.min.css --minify"
Expand Down
4 changes: 4 additions & 0 deletions server/docker/etc/s6-overlay/scripts/runas-user
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ if [[ -z $ACCOUNT_PREMIUM ]]; then
ACCOUNT_PREMIUM=-1
fi

if [[ -z $LIMITER_ENABLED ]]; then
LIMITER_ENABLED=true
fi

echo '
--------------------------------------------
Settings
Expand Down
16 changes: 10 additions & 6 deletions server/src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// Try to load .env file and make it available for getenv to use.
try{
(new DevCoder\DotEnv(ROOT . '/.env'))->load();
(new DevCoder\DotEnv(ROOT . '/.env', array(DevCoder\Processor\QuotedProcessor::class)))->load();
}catch(Exception $ignored){}

class Settings{
Expand All @@ -21,7 +21,7 @@ class Settings{
*/

public static function getVersion() : string{
return '8.1.1';
return '8.1.2';
}

public static function getLocation() : string{
Expand Down Expand Up @@ -89,7 +89,8 @@ public static function getDBPassword() : string{
}

public static function getDBSSL() : bool{
return getenv('MYSQL_SSL', true) === 'true';
$enabled = getenv('MYSQL_SSL', true) ?: getenv('MYSQL_SSL') ?: 'false';
return in_array($enabled, array('true', '1'), true);
}

public static function getDBSSLCA() : string{
Expand Down Expand Up @@ -165,7 +166,8 @@ public static function getRedisLocalPassword() : string{
*/

public static function getMail() : bool{
return getenv('MAIL_ENABLED', true) === 'true';
$enabled = getenv('MAIL_ENABLED', true) ?: getenv('MAIL_ENABLED') ?: 'false';
return in_array($enabled, array('true', '1'), true);
}

public static function getMailHost() : string{
Expand All @@ -185,7 +187,8 @@ public static function getMailPassword() : string{
}

public static function getMailTLS() : bool{
return getenv('MAIL_USE_TLS', true) === 'true';
$enabled = getenv('MAIL_USE_TLS', true) ?: getenv('MAIL_USE_TLS') ?: 'false';
return in_array($enabled, array('true', '1'), true);
}

/*
Expand Down Expand Up @@ -227,7 +230,8 @@ public static function getYubiId() : int{
*/

public static function getLimiter() : bool{
return getenv('LIMITER_ENABLED', true) === 'true';
$enabled = getenv('LIMITER_ENABLED', true) ?: getenv('LIMITER_ENABLED') ?: 'true';
return in_array($enabled, array('true', '1'), true);
}

public static function getLimiterGetInfo() : int{
Expand Down

0 comments on commit 33c817f

Please sign in to comment.