Skip to content

Commit 3069299

Browse files
committed
cleanup gitpod struct
1 parent 564594d commit 3069299

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

command/src/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,17 @@ impl Repository {
138138
}
139139
}
140140
struct Gitpod {
141-
workspace_domain: String,
142-
workspace_url: String,
141+
domain: String,
142+
url: String,
143143
}
144144

145145
impl Gitpod {
146146
fn load() -> Self {
147-
let workspace_url = std::env::var("GITPOD_WORKSPACE_URL").unwrap();
147+
let workspace_url = std::env::var("GITPOD_WORKSPACE_URL").expect("Not running in Gitpod");
148148

149149
Self {
150-
workspace_domain: workspace_url.replace("https://", "8080-"),
151-
workspace_url: workspace_url.replace("https://", "https://8080-"),
150+
domain: workspace_url.replace("https://", "8080-"),
151+
url: workspace_url.replace("https://", "https://8080-"),
152152
}
153153
}
154154

@@ -224,8 +224,8 @@ fn setup(mut config: Config) -> std::io::Result<()> {
224224

225225
if Gitpod::is_host() {
226226
let gitpod = Gitpod::load();
227-
config.lila_domain = Some(gitpod.workspace_domain);
228-
config.lila_url = Some(gitpod.workspace_url);
227+
config.lila_domain = Some(gitpod.domain);
228+
config.lila_url = Some(gitpod.url);
229229
}
230230

231231
config.save();
@@ -596,11 +596,11 @@ mod tests {
596596

597597
let gitpod = Gitpod::load();
598598
assert_eq!(
599-
gitpod.workspace_domain,
599+
gitpod.domain,
600600
"8080-lichessorg-liladocker-abc123.ws-us123.gitpod.io"
601601
);
602602
assert_eq!(
603-
gitpod.workspace_url,
603+
gitpod.url,
604604
"https://8080-lichessorg-liladocker-abc123.ws-us123.gitpod.io"
605605
);
606606
}

0 commit comments

Comments
 (0)