-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor based on sveltia-cms-auth (#8)
- Loading branch information
1 parent
eee8da8
commit bcc0fbd
Showing
19 changed files
with
5,081 additions
and
2,088 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
NODE_ENV=production | ||
ALLOWED_DOMAINS=example.com,*.example.com # Domain patterns for CMS installations using the IDRC CMS Authenticator | ||
OAUTH_CLIENT_ID="" # GitHub or GitLab OAuth application client ID | ||
OAUTH_CLIENT_SECRET="" # GitHub or GitLab OAuth application client secret | ||
ORIGINS=example.com,*.example.com # Domain patterns for CMS installations using the IDRC CMS Authenticator | ||
PORT=3000 | ||
REDIRECT_URL=https://auth.example.com/callback # A full URL to the /callback route of your deployed IDRC CMS Authenticator. This will also be configured as the callback URL in your GitHub or GitLab OAuth application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ALLOWED_DOMAINS=example.com,*.example.com | ||
OAUTH_CLIENT_ID=client-id | ||
OAUTH_CLIENT_SECRET=client-secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Lint, format and test | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint-format-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cache node modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | ||
- name: Install dependencies and lint files | ||
run: | | ||
npm ci | ||
npm run lint | ||
npm run format | ||
npm run test | ||
- name: Save code coverage to artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: code-coverage | ||
path: "coverage/clover.xml" | ||
retention-days: 5 | ||
upload-coverage: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- lint-format-test | ||
steps: | ||
- name: Fetch code coverage artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: code-coverage | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.env | ||
coverage | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
lint-staged | ||
npx --no-install lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
".": "0.0.1" | ||
".": "0.0.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
require("dotenv").config({ silent: true }); | ||
|
||
const express = require("express"); | ||
const cookieParser = require("cookie-parser"); | ||
const middleware = require("./middleware/index.js"); | ||
const port = process.env.PORT || 3000; | ||
|
||
const app = express(); | ||
app.use(cookieParser()); | ||
|
||
app.get("/", (_req, res) => { | ||
res.status(404).send(); | ||
}); | ||
|
||
app.get("/auth", middleware.auth); | ||
app.get("/callback", middleware.callback); | ||
app.get("/success", middleware.success); | ||
app.get("/", middleware.index); | ||
|
||
app.listen(port, () => { | ||
console.log(`IDRC CMS Authenticator listening on port ${port}.`); | ||
}); | ||
app.listen(port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.