mirror of
https://github.com/pelican-dev/panel.git
synced 2026-02-15 19:07:50 +03:00
Compare commits
2 Commits
lance/1769
...
lance/2132
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b91af3118 | ||
|
|
4ece9dcf2e |
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user