diff --git a/README.md b/README.md index 9861b1d6..4e3c9c1a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Here are the key metrics visualized in these charts: 2. **Total Suggestions** This chart illustrates the total number of code suggestions made by GitHub Copilot. It offers a view of the tool's activity and its engagement with users over time. -3. **Total Acceptances:** This visualization focuses on the total number of suggestions accepted by users. +3. **Total Acceptances:** This visualization focuses on the total number of suggestions accepted by users.

image @@ -70,7 +70,7 @@ The language breakdown analysis tab also displays a table showing the Accepted P 4. **Total Active Copilot Chat Users:** a bar chart that illustrates the total number of users who have actively interacted with Copilot over the past 28 days. -## Seat Analysis +## Seat Analysis

image

@@ -88,7 +88,7 @@ The language breakdown analysis tab also displays a table showing the Accepted P In the `.env` file, you can configure several environment variables that control the behavior of the application. -#### VUE_APP_SCOPE +#### VUE_APP_SCOPE The `VUE_APP_SCOPE` environment variable in the `.env` file determines the scope of the API calls made by the application. It can be set to either 'enterprise' or 'organization'. @@ -161,6 +161,8 @@ Proxy can authenticate user using GitHub App. In order to do that, following env * `GITHUB_CLIENT_SECRET` - client secret of the GitHub App * `SESSION_SECRET` - random string for securing session state +If you want use a custom path for your `.env` file you can set the environment variable `DOTENV_CONFIG_PATH`. + https://github.com/user-attachments/assets/e5596067-da9c-409d-9b9f-0a688cc1f2c4 It's also possible to run with **PAT Token**, see examples below for required variables. @@ -180,6 +182,15 @@ To run: docker run -it --rm -p 8080:3000 --env-file ./.env copilot-metrics-viewer-with-proxy ``` +Or with custom path for your `.env` file: + +```bash +docker run -it --rm -p 8080:3000 \ +-e DOTENV_CONFIG_PATH=/custom/.env \ +-v /path/to/your/.env:/custom/.env \ +copilot-metrics-viewer-with-proxy +``` + Proxy can also run with token hardcoded on the backend (which hides it from frontend calls), here's a sample: ```bash @@ -204,16 +215,16 @@ docker run -it --rm -p 3000:3000 \ copilot-metrics-viewer-with-proxy ``` -## License +## License This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE.txt) for the full terms. -## Maintainers +## Maintainers [@martedesco](https://github.com/martedesco) & [@karpikpl](https://github.com/karpikpl) ## Support -This project is independently developed and maintained, and is not an official GitHub product. It thrives through the dedicated efforts of ([@martedesco](https://github.com/martedesco)), ([@karpikpl](https://github.com/karpikpl)) our wonderful contributors. A heartfelt thanks to all our contributors! ✨ +This project is independently developed and maintained, and is not an official GitHub product. It thrives through the dedicated efforts of ([@martedesco](https://github.com/martedesco)), ([@karpikpl](https://github.com/karpikpl)) our wonderful contributors. A heartfelt thanks to all our contributors! ✨ I aim to provide support through [GitHub Issues](https://github.com/github-copilot-resources/copilot-metrics-viewer/issues). While I strive to stay responsive, I can't guarantee immediate responses. For critical issues, please include "CRITICAL" in the title for quicker attention. 🙏🏼 diff --git a/api/server.mjs b/api/server.mjs index 162d1559..eac61854 100644 --- a/api/server.mjs +++ b/api/server.mjs @@ -8,8 +8,15 @@ import { createProxyMiddleware } from 'http-proxy-middleware'; // Construct __dirname equivalent in ES module scope const __dirname = path.dirname(fileURLToPath(import.meta.url)); -dotenv.config({ path: path.join(__dirname, '.env') }); -//dotenv.config(); + +const DOTENV_CONFIG_PATH = process.env.DOTENV_CONFIG_PATH; + +if (DOTENV_CONFIG_PATH) { + console.log("DOTENV_CONFIG_PATH is set to: ", DOTENV_CONFIG_PATH) + dotenv.config({ path: DOTENV_CONFIG_PATH }); +} else { + dotenv.config({ path: path.join(__dirname, '.env') }); +} const app = express(); @@ -127,4 +134,4 @@ process.on('SIGINT', () => { }); const PORT = process.env.PORT || 3000; -app.listen(PORT, () => console.log(`Server running on port ${PORT}`)); \ No newline at end of file +app.listen(PORT, () => console.log(`Server running on port ${PORT}`));