Compare commits

..

2 Commits

Author SHA1 Message Date
Lance Pioch
3b91af3118 Use absolute .env path and remove redundant grep filter
- Use /var/www/html/.env consistently (matches line 3)
- Remove grep -ve "^#" since ^${VAR}= already excludes comment lines
2026-02-07 22:17:53 -05:00
Lance Pioch
4ece9dcf2e Strip quotes from .env values in Docker entrypoint
The previous grep+export approach passed surrounding quotes literally
into environment variables, causing nc to fail with bad address errors
when DB_HOST or DB_PORT were quoted in .env files.

Fixes #2132
2026-02-05 22:23:24 -05:00
4 changed files with 8 additions and 26 deletions

View File

@@ -113,12 +113,6 @@ class CreateNode extends CreateRecord
return;
}
if (in_array(strtolower($state), Node::BANNED_FQDNS)) {
$set('dns', false);
return;
}
$ip = get_ip_from_hostname($state);
if ($ip) {
$set('dns', true);

View File

@@ -174,12 +174,6 @@ class EditNode extends EditRecord
return;
}
if (in_array(strtolower($state), Node::BANNED_FQDNS)) {
$set('dns', false);
return;
}
$ip = get_ip_from_hostname($state);
if ($ip) {
$set('dns', true);

View File

@@ -18,7 +18,6 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
use Symfony\Component\Yaml\Yaml;
/**
@@ -73,8 +72,6 @@ class Node extends Model implements Validatable
public const DAEMON_TOKEN_LENGTH = 64;
public const BANNED_FQDNS = ['0.0.0.0', '127.0.0.1', 'localhost'];
/**
* The attributes excluded from the model's JSON form.
*/
@@ -98,7 +95,7 @@ class Node extends Model implements Validatable
'name' => ['required', 'string', 'min:1', 'max:100'],
'description' => ['string', 'nullable'],
'public' => ['boolean'],
'fqdn' => ['required', 'string'],
'fqdn' => ['required', 'string', 'notIn:0.0.0.0,127.0.0.1,localhost'],
'scheme' => ['required', 'string', 'in:http,https'],
'behind_proxy' => ['boolean'],
'memory' => ['required', 'numeric', 'min:0'],
@@ -117,14 +114,6 @@ class Node extends Model implements Validatable
'tags' => ['array'],
];
public static function getRules(): array
{
$rules = static::$validationRules;
$rules['fqdn'][] = Rule::notIn(static::BANNED_FQDNS);
return $rules;
}
/**
* Default values for specific columns that are generally not changed on base installs.
*/

View File

@@ -2,8 +2,13 @@
# check for .env file or symlink and generate app keys if missing
if [ -f /var/www/html/.env ]; then
echo "external vars exist."
# load specific env vars from .env used in the entrypoint and they are not already set
for VAR in "APP_KEY" "APP_INSTALLED" "DB_CONNECTION" "DB_HOST" "DB_PORT"; do if ! (printenv | grep -q ${VAR}); then export $(grep ${VAR} .env | grep -ve "^#"); fi; done
# load specific env vars from .env used in the entrypoint if they are not already set
for VAR in "APP_KEY" "APP_INSTALLED" "DB_CONNECTION" "DB_HOST" "DB_PORT"; do
if ! (printenv | grep -q "^${VAR}="); then
VAL=$(grep "^${VAR}=" /var/www/html/.env | head -1 | cut -d= -f2- | sed -e 's/^"//' -e 's/"$//' -e "s/^'//" -e "s/'$//")
if [ -n "$VAL" ]; then export "${VAR}=${VAL}"; fi
fi
done
else
echo "external vars don't exist."
# webroot .env is symlinked to this path