Repository navigation
[DEVEX-707] fix(application init): align with TS config seeding and validation - #126
Conversation
jpage-godaddy
left a comment
There was a problem hiding this comment.
Looks good to me. Let's check Copilot's reviews as well.
There was a problem hiding this comment.
Pull request overview
This PR updates the application init workflow to better align with config seeding/validation behavior by allowing flags to be optional, seeding missing values from an explicit --config, validating required fields (including rejecting non-public URLs), and writing both godaddy.toml and .env (best-effort) while returning filesWritten in the JSON result.
Changes:
- Add
.envpath resolution plus a merge/write helper that preserves unrelated.envcontent while updating GoDaddy-owned keys. - Introduce
is_public_routable_urland use it duringapplication initto reject localhost/private/link-local style URLs. - Update
application initoutput schema/result shape (addsfilesWritten, changes returned fields) and add theurlcrate dependency.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
rust/src/config/mod.rs |
Adds .env path convention and a merge-based .env writer for app secrets. |
rust/src/application/public_url.rs |
Introduces URL “public routable” validation with unit tests. |
rust/src/application/mod.rs |
Exposes the new public_url module. |
rust/src/application/commands/mod.rs |
Reworks application init flag/config merging, required-field validation, URL validation, and best-effort writes with filesWritten output. |
rust/Cargo.toml |
Adds the url dependency used by the new validator. |
rust/Cargo.lock |
Locks the new url dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Some(Host::Ipv4(addr)) => { | ||
| let octets = addr.octets(); | ||
| let is_shared = octets[0] == 100 && (64..=127).contains(&octets[1]); | ||
| !(octets[0] == 0 | ||
| || addr.is_loopback() | ||
| || addr.is_private() | ||
| || addr.is_link_local() | ||
| || is_shared) | ||
| } | ||
| Some(Host::Ipv6(addr)) => { | ||
| let seg0 = addr.segments()[0]; | ||
| let is_unique_local = (seg0 & 0xfe00) == 0xfc00; // fc00::/7 | ||
| !(addr.is_loopback() | ||
| || addr.is_unspecified() | ||
| || addr.is_unicast_link_local() | ||
| || is_unique_local) | ||
| } |
There was a problem hiding this comment.
is_global() is unstable (feature(ip)), not usable on our build, use the explicit checks
Summary
--config(write still targets the default envgodaddy.toml/.env)url/proxy-urlfilesWrittenin the JSON resultwrite_env_filemerge helper andis_public_routable_urlwith unit testsTest plan
cargo build/cargo test/cargo clippy -- -D warnings/cargo fmt --check