-
Notifications
You must be signed in to change notification settings - Fork 5
Add --login-origin options and Make it single input option
#91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| DRFED_LOGIN_ORIGINS=https://drfed.example.com,http://localhost:3000 | ||
| DRFED_LOGIN_ORIGIN=https://drfed.example.com | ||
| DRFED_ROOT_ORIGIN=http://drfed.localhost:8888 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ import { message, optionNames } from "@optique/core/message"; | |
| import { map, optional, withDefault } from "@optique/core/modifiers"; | ||
| import type { InferValue } from "@optique/core/parser"; | ||
| import { flag, option } from "@optique/core/primitives"; | ||
| import { email, socketAddress, url } from "@optique/core/valueparser"; | ||
| import { email, origin, socketAddress, url } from "@optique/core/valueparser"; | ||
| import { loggingOptions } from "@optique/logtape"; | ||
| import { path } from "@optique/run/valueparser"; | ||
| import { LogTapeTransport } from "@upyo/logtape"; | ||
|
|
@@ -124,6 +124,14 @@ const emailFromParser = optional( | |
| }), | ||
| ); | ||
|
|
||
| const loginOriginParser = option( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes |
||
| "--login-origin", | ||
| origin({ allowedProtocols: ["http:", "https:"] }), | ||
| { | ||
| description: message`The frontend origin allowed in email login links.`, | ||
| }, | ||
| ); | ||
|
|
||
| const serverParser = object("DrFed server", { | ||
| address: withDefault( | ||
| option("--listen", "-l", socketAddress({ requirePort: true }), { | ||
|
|
@@ -146,6 +154,7 @@ const serverParser = object("DrFed server", { | |
| }), | ||
| ), | ||
| rootOrigin: rootOriginParser, | ||
| loginOrigin: loginOriginParser, | ||
| emailFrom: emailFromParser, | ||
| mailer: smtpParser, | ||
| seed: seedParser, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,9 +46,9 @@ export interface YogaServerOptions { | |
| emailFrom?: string | undefined; | ||
|
|
||
| /** | ||
| * Origin list for login. | ||
| * Origin for login. | ||
| */ | ||
| loginOrigins: ReadonlySet<string>; | ||
| loginOrigin: URL; | ||
|
|
||
| /** | ||
| * The root origin of this deployment. Every instance is served from a | ||
|
|
@@ -116,7 +116,7 @@ const fillOptions = ( | |
| // at drfed.org would fail the SPF and DMARC checks of every deployment but | ||
| // the project's own, and the login mail would be rejected or junked. | ||
| emailFrom: opt.emailFrom ?? `noreply@${canonicalHostname(opt.rootOrigin)}`, | ||
| loginOrigins: opt.loginOrigins, | ||
| loginOrigin: opt.loginOrigin, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The CLI normalizes the trailing dot, but direct |
||
| rootOrigin: opt.rootOrigin, | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ try { | |
| // DNS or /etc/hosts setup, which is what makes per-instance subdomains usable | ||
| // in development. | ||
| const defaultRootOrigin = "http://drfed.localhost:8888"; | ||
| const defaultLoginOrigin = "http://drfed.localhost:3000"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When |
||
| const isWindows = process.platform === "win32"; | ||
| const pnpm = isWindows ? "pnpm.cmd" : "pnpm"; | ||
|
|
||
|
|
@@ -317,13 +318,13 @@ try { | |
|
|
||
| const serverArgs: string[] = [ | ||
| "--watch", | ||
| "--env-file=.env", | ||
| "bin/drfed-server.mjs", | ||
| "--pglite-data-path", | ||
| "../../.pgdata", | ||
| "--listen=0.0.0.0:8888", | ||
| "--log-format=color", | ||
| `--root-origin=${process.env.DRFED_ROOT_ORIGIN ?? defaultRootOrigin}`, | ||
| `--login-origin=${process.env.DRFED_LOGIN_ORIGIN ?? defaultLoginOrigin}`, | ||
| ]; | ||
|
|
||
| const logLevel = process.env.usage_log_level; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation still describes the old interface: packages/drfed/README.md requires
DRFED_LOGIN_ORIGINSand shows a command that now fails, while packages/graphql/README.md passesloginOrigins: new Set(...). Please update these examples to match the final configuration and API. The comments in scripts/dev.mts and packages/drfed/src/parser.test.ts also still refer to the removed behavior.