diff options
| -rw-r--r-- | README.ja.md | 17 | ||||
| -rw-r--r-- | README.md | 18 |
2 files changed, 29 insertions, 6 deletions
diff --git a/README.ja.md b/README.ja.md index 683519a..2c101ed 100644 --- a/README.ja.md +++ b/README.ja.md @@ -4,6 +4,14 @@ ユーザー登録、ログイン、セッション管理を処理し、認証されたリクエストを設定済みのバックエンドにプロキシします。また、ユーザー管理のための管理ダッシュボードも含まれています。 +## なぜ作ったか +私の作成している +[GitHub - haturatu/puremania: No security, very fast, web UI self-hosted online storage](https://github.com/haturatu/puremania) +がありますが、これに複雑になりがちな認証機能を持たせなくなかったからです。 +また、一つのアプリケーションに認証を組み込むとセキュリティ上は良いですがID/Passwordなどをそれぞれに合わせて作成する必要がありとても面倒です。 +特にセルフホストが好きな人にとってはどうアクセス制御するか、です。 +ある主、このサーバーが認証基盤として機能して同じDBを参照することによってユーザ情報は共有できます。 + ## 主な機能 - **認証**: ログイン、ログアウト、登録ページを提供します。 @@ -91,9 +99,13 @@ APIリクエストの場合、クライアントは`Authorization: Bearer <token 設定はプロジェクトのルートにある `.env` ファイルで管理されます。`.env` という名前のファイルを作成し、必要な変数を追加してください。 -**`.env` ファイルの例:** +# `.env` ファイルの例: ```dotenv +# --- サーバー設定 --- +# プロキシサーバーがリッスンするポート +LISTEN_PORT=8080 + # --- 必須 --- # 保護したいバックエンドサービスのURL TARGET_URL=http://localhost:8081 @@ -327,7 +339,8 @@ Authorization: Bearer <access_token> | `SESSION_SECRET` | **(必須)** セッションクッキーの暗号化とJWTの署名に使用する、長くてランダムな秘密鍵。 | `default-secret-key-for-dev` | | `DATABASE_URL` | PostgreSQLまたはMySQLの接続文字列。設定されている場合、`DATABASE_PATH`より優先されます。 | - | | `DATABASE_PATH` | SQLiteデータベースのファイルパス。`DATABASE_URL`が設定されていない場合のみ使用されます。 | `./auth.db` | -| `LOG_LEVEL` | ログレベルを設定します。`DEBUG`, `INFO`, `WARN`, `ERROR`が指定できます。 | `INFO` | +| `LOG_LEVEL` | ログレベルを設定します。`DEBUG`, `INFO`, `WARN`, `ERROR`が指定できます。 | `INFO` | +| `LISTEN_PORT` | プロキシサーバーがリッスンするポート。 | `8080` | | `FRONTEND_TYPE` | フロントエンドのレンダリングモードを切り替えます。`js`または`php`が指定できます。 | `js` | | `PHP_FPM_SOCKET` | PHP-FPMソケットへのファイルパス。`FRONTEND_TYPE`が`php`の場合のみ使用されます。 | `/run/php-fpm/php-fpm.sock` | | `PHP_DOC_ROOT` | PHPファイルディレクトリへの絶対パス。`FRONTEND_TYPE`が`php`の場合のみ使用されます。 | - | @@ -4,6 +4,12 @@ This is a simple authenticating reverse proxy written in Go. It provides a flexi It handles user registration, login, and session management, and proxies authenticated requests to the configured backend. It also includes an administration dashboard for user management. +## Why I Built This + +I'm also the developer of [puremania](https://github.com/haturatu/puremania), and I wanted to avoid adding complex authentication logic to that project. +While integrating authentication into every application is good for security, it's a hassle to manage separate IDs and passwords for each one. This is a common problem for self-hosting enthusiasts who need a centralized way to control access. +This project aims to solve that by acting as a central authentication service. By referencing the same database, user information can be shared across different applications. + ## Features - **Authentication**: Provides login, logout, and registration pages. @@ -92,13 +98,16 @@ For API requests, the client must include the JWT Access Token in the `Authoriza Configuration is managed via a `.env` file in the root of the project. Create a file named `.env` and add the necessary variables. -**Example `.env` file:** +# Example `.env` file: ```dotenv -# --- Required --- +# --- Server Settings --- +# The port for the proxy server to listen on +LISTEN_PORT=8080 + +# --- Required --- # The URL of the backend service you want to protect TARGET_URL=http://localhost:8081 - # A long, random string for securing session cookies and JWTs # For production, generate a new key using: openssl rand -base64 45 SESSION_SECRET=my-super-secret-key @@ -328,7 +337,8 @@ The `refresh_token` is a long-lived token that can be used to obtain a new acces | `SESSION_SECRET` | **(Required)** A long, random secret key for encrypting session cookies and signing JWTs. | `default-secret-key-for-dev` | | `DATABASE_URL` | The connection string for PostgreSQL or MySQL. If set, this overrides `DATABASE_PATH`. | - | | `DATABASE_PATH` | The file path for the SQLite database. Used only if `DATABASE_URL` is not set. | `./auth.db` | -| `LOG_LEVEL` | Sets the logging level. Can be `DEBUG`, `INFO`, `WARN`, `ERROR`. | `INFO` | +| `LOG_LEVEL` | Sets the logging level. Can be `DEBUG`, `INFO`, `WARN`, `ERROR`. | `INFO` | +| `LISTEN_PORT` | The port for the proxy server to listen on. | `8080` | | `FRONTEND_TYPE` | Switches the frontend rendering mode. Can be `js` or `php`. | `js` | | `PHP_FPM_SOCKET` | The file path to the PHP-FPM socket. Used only when `FRONTEND_TYPE` is `php`. | `/run/php-fpm/php-fpm.sock` | | `PHP_DOC_ROOT` | The absolute path to the PHP files directory. Used only when `FRONTEND_TYPE` is `php`. | - | |
