commit dee6fd91d743908f16257b0f51b02f32a1462939 Author: hotstovejer Date: Mon Jul 14 13:54:30 2025 -0500 Add config.php diff --git a/config.php b/config.php new file mode 100644 index 0000000..70dd2df --- /dev/null +++ b/config.php @@ -0,0 +1,134 @@ + APP_PUBLIC_PATH, + 'public_dir' => APP_PUBLIC_DIR, + 'overwrite_on_upload' => false, + 'timezone' => 'UTC', // https://www.php.net/manual/en/timezones.php + 'download_inline' => ['pdf'], // download inline in the browser, array of extensions, use * for all + 'lockout_attempts' => 5, // max failed login attempts before ip lockout + 'lockout_timeout' => 15, // ip lockout timeout in seconds + + 'frontend_config' => [ + 'app_name' => 'FileGator', + 'app_version' => APP_VERSION, + 'language' => 'english', + 'logo' => 'https://filegator.io/filegator_logo.svg', + 'upload_max_size' => 100 * 1024 * 1024, // 100MB + 'upload_chunk_size' => 1 * 1024 * 1024, // 1MB + 'upload_simultaneous' => 3, + 'default_archive_name' => 'archive.zip', + 'editable' => ['.txt', '.css', '.js', '.ts', '.html', '.php', '.json', '.md'], + 'date_format' => 'YY/MM/DD hh:mm:ss', // see: https://momentjs.com/docs/#/displaying/format/ + 'guest_redirection' => '', // useful for external auth adapters + 'search_simultaneous' => 5, + 'filter_entries' => [], + ], + + 'services' => [ + 'Filegator\Services\Logger\LoggerInterface' => [ + 'handler' => '\Filegator\Services\Logger\Adapters\MonoLogger', + 'config' => [ + 'monolog_handlers' => [ + function () { + return new \Monolog\Handler\StreamHandler( + __DIR__.'/private/logs/app.log', + \Monolog\Logger::DEBUG + ); + }, + ], + ], + ], + 'Filegator\Services\Session\SessionStorageInterface' => [ + 'handler' => '\Filegator\Services\Session\Adapters\SessionStorage', + 'config' => [ + 'handler' => function () { + $save_path = null; // use default system path + //$save_path = __DIR__.'/private/sessions'; + $handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler($save_path); + + return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([ + "cookie_samesite" => "Lax", + "cookie_secure" => null, + "cookie_httponly" => true, + ], $handler); + }, + ], + ], + 'Filegator\Services\Cors\Cors' => [ + 'handler' => '\Filegator\Services\Cors\Cors', + 'config' => [ + 'enabled' => APP_ENV == 'production' ? false : true, + ], + ], + 'Filegator\Services\Tmpfs\TmpfsInterface' => [ + 'handler' => '\Filegator\Services\Tmpfs\Adapters\Tmpfs', + 'config' => [ + 'path' => __DIR__.'/private/tmp/', + 'gc_probability_perc' => 10, + 'gc_older_than' => 60 * 60 * 24 * 2, // 2 days + ], + ], + 'Filegator\Services\Security\Security' => [ + 'handler' => '\Filegator\Services\Security\Security', + 'config' => [ + 'csrf_protection' => true, + 'csrf_key' => "123456", // randomize this + 'ip_allowlist' => [], + 'ip_denylist' => [], + 'allow_insecure_overlays' => false, + ], + ], + 'Filegator\Services\View\ViewInterface' => [ + 'handler' => '\Filegator\Services\View\Adapters\Vuejs', + 'config' => [ + 'add_to_head' => '', + 'add_to_body' => '', + ], + ], + 'Filegator\Services\Storage\Filesystem' => [ + 'handler' => '\Filegator\Services\Storage\Filesystem', + 'config' => [ + 'separator' => '/', + 'config' => [], + 'adapter' => function () { + return new \League\Flysystem\Adapter\Local( + __DIR__.'/repository' + ); + }, + ], + ], + 'Filegator\Services\Archiver\ArchiverInterface' => [ + 'handler' => '\Filegator\Services\Archiver\Adapters\ZipArchiver', + 'config' => [], + ], + 'Filegator\Services\Auth\AuthInterface' => [ + 'handler' => '\Filegator\Services\Auth\Adapters\LDAP', + 'config' => [ + 'private_repos' => false, + 'ldap_server'=>'ldap://192.168.1.6', + 'ldap_bindDN'=>'uid=filegator,cn=sysaccounts,cn=etc,dc=migonis,dc=dom', + 'ldap_bindPass'=>'hEUt_iQKxdBANZXaFEWa', + 'ldap_baseDN'=>'cn=users,cn=accounts,dc=migonis,dc=dom', + 'ldap_filter'=>'(uid=*)', //ex: 'ldap_filter'=>'(&(uid=*)(memberOf=cn=administrators,cn=groups,dc=ldap,dc=example,dc=com))', + 'ldap_attributes' => ["uid","cn","dn"], + 'ldap_userFieldMapping'=> [ + 'username' =>'uid', + 'username_AddDomain' =>'@example.com', + 'username_RemoveDomains' =>['@department1.example.com', '@department2.example.com'], + 'name' =>'uid', + 'userDN' =>'dn', + 'default_permissions' => 'read|write|upload|download|batchdownload|zip', + 'admin_usernames' =>['hotstovejer'], + ], + ], + ], + 'Filegator\Services\Router\Router' => [ + 'handler' => '\Filegator\Services\Router\Router', + 'config' => [ + 'query_param' => 'r', + 'routes_file' => __DIR__.'/backend/Controllers/routes.php', + ], + ], + ], +]; \ No newline at end of file