dotenv
This commit is contained in:
parent
6b55ae7c70
commit
faec659fd2
9 changed files with 18 additions and 73 deletions
6
.env.example
Normal file
6
.env.example
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
client_id=client
|
||||||
|
client_secret=secret
|
||||||
|
keycloak_token_url=https://keycloak.example.com/auth/realms/master/protocol/openid-connect/token
|
||||||
|
realm=master
|
||||||
|
users_path=/srv/dav/public
|
||||||
|
base_uri=/
|
|
@ -19,7 +19,8 @@
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"sabre/dav": "^4.6",
|
"sabre/dav": "^4.6",
|
||||||
"ext-curl": "*"
|
"ext-curl": "*",
|
||||||
|
"vlucas/phpdotenv": "^5.6"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
version: '3.7'
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
image: nginx:alpine
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
volumes:
|
|
||||||
- ./:/var/www/html
|
|
||||||
- ./docker/conf/default.conf:/etc/nginx/conf.d/default.conf
|
|
||||||
php:
|
|
||||||
build:
|
|
||||||
context: ./docker
|
|
||||||
volumes:
|
|
||||||
- ./:/var/www/html
|
|
||||||
- ./docker/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
|
|
||||||
mysql:
|
|
||||||
image: mysql:latest
|
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
environment:
|
|
||||||
MYSQL_ROOT_PASSWORD: root
|
|
||||||
MYSQL_DATABASE: webapp
|
|
||||||
MYSQL_USER: webapp
|
|
||||||
MYSQL_PASSWORD: root
|
|
|
@ -1,15 +0,0 @@
|
||||||
FROM php:8.3-fpm
|
|
||||||
|
|
||||||
ARG WITH_XDEBUG=true
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
libfreetype6-dev \
|
|
||||||
libjpeg62-turbo-dev \
|
|
||||||
libpng-dev \
|
|
||||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
||||||
&& docker-php-ext-install -j$(nproc) gd \
|
|
||||||
&& docker-php-ext-install mysqli \
|
|
||||||
&& docker-php-ext-install pdo pdo_mysql; \
|
|
||||||
if [ $WITH_XDEBUG = "true" ] ; then \
|
|
||||||
pecl install xdebug; \
|
|
||||||
fi ;
|
|
|
@ -1,22 +0,0 @@
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
index index.php index.html;
|
|
||||||
server_name localhost;
|
|
||||||
error_log /var/log/nginx/error.log;
|
|
||||||
access_log /var/log/nginx/access.log;
|
|
||||||
root /var/www/html/src;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri.js /index.php$is_args$args;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
|
||||||
try_files $uri =404;
|
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
||||||
fastcgi_pass php:9000;
|
|
||||||
fastcgi_index index.php;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
[Xdebug]
|
|
||||||
zend_extension=xdebug.so
|
|
||||||
xdebug.mode=debug
|
|
||||||
xdebug.client_port = 9000
|
|
||||||
xdebug.client_host = host.docker.internal
|
|
||||||
xdebug.idekey=PHPSTORM
|
|
|
@ -2,10 +2,15 @@
|
||||||
|
|
||||||
use Collections\HomeCollection;
|
use Collections\HomeCollection;
|
||||||
use Sabre\DAV;
|
use Sabre\DAV;
|
||||||
|
use Dotenv\Dotenv;
|
||||||
|
|
||||||
// The autoloader
|
// The autoloader
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
|
$dotenv = Dotenv::createImmutable(__DIR__);
|
||||||
|
$dotenv->load();
|
||||||
|
|
||||||
|
|
||||||
$aclPlugin = new \Sabre\DAVACL\Plugin();
|
$aclPlugin = new \Sabre\DAVACL\Plugin();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class KeycloakAuth extends AbstractBasic
|
||||||
private $client_secret;
|
private $client_secret;
|
||||||
private $keycloakTokenUrl;
|
private $keycloakTokenUrl;
|
||||||
|
|
||||||
public function __construct(AclPlugin $plugin, $client_id, $client_secret, $keycloakTokenUrl)
|
public function __construct(AclPlugin $plugin, string $client_id, string $client_secret, string $keycloakTokenUrl)
|
||||||
{
|
{
|
||||||
$this->aclPlugin = $plugin;
|
$this->aclPlugin = $plugin;
|
||||||
$this->client_id = $client_id;
|
$this->client_id = $client_id;
|
||||||
|
@ -20,7 +20,7 @@ class KeycloakAuth extends AbstractBasic
|
||||||
$this->keycloakTokenUrl = $keycloakTokenUrl;
|
$this->keycloakTokenUrl = $keycloakTokenUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function validateUserPass($username, $password)
|
protected function validateUserPass($username, $password) : bool
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue