Skip to content

Commit 33db5e8

Browse files
simplified, removed unneeded checkouts, updated template (#14)
* simplified, removed unneeded checkouts, updated template * improved init * simplified slightly * Update data/default.toml --------- Co-authored-by: Funny <[email protected]>
1 parent 2a89787 commit 33db5e8

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

data/basalt.Dockerfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
FROM rust:1.84 as basalt-compilation
22

3-
RUN touch /redocly
4-
RUN chmod +x /redocly
3+
RUN touch /redocly && chmod +x /redocly
54
ENV PATH=/:$PATH
65
RUN git clone https://github.com/basalt-rs/basalt-server
76

87
WORKDIR /basalt-server
98

10-
# TODO: remove
11-
RUN git checkout optional-docs
129
RUN cargo build --release --no-default-features
1310

1411
{% if web_client %}
1512
FROM node:22 as web-compilation
1613

1714
RUN git clone https://github.com/basalt-rs/basalt /basalt
1815

19-
# TODO: Remove
20-
WORKDIR /basalt
21-
# TODO: Remove
22-
RUN git checkout no-ssr
23-
2416
WORKDIR /basalt/client
2517
RUN npm ci
2618
RUN npm run build
@@ -32,8 +24,7 @@ FROM fedora:rawhide as setup
3224
WORKDIR /setup
3325

3426
COPY install.sh .
35-
RUN chmod +x install.sh
36-
RUN ./install.sh
27+
RUN chmod +x install.sh && ./install.sh
3728

3829
FROM setup as execution
3930

data/default.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99

1010
port = 8517
1111

12+
# state whether the server should expose a web client
13+
web_client = true
14+
1215
[setup]
1316
# import = "./setup.toml"
1417

1518
# install = { import = "./install.sh" }
1619
install = '''
17-
dnf install opam
20+
dnf install opam -y
1821
'''
1922

2023
# init = { import = "./init.sh" }

src/init.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,31 @@ pub async fn handle(path: Option<PathBuf>) -> anyhow::Result<()> {
3232
"basalt".to_owned()
3333
};
3434

35-
let path = path.map_or(PathBuf::from(&name), |p| {
36-
if p.file_name().is_some() {
37-
p
38-
} else {
39-
p.with_file_name(name.clone()).with_extension("toml")
40-
}
41-
});
35+
let path = path
36+
.map_or(PathBuf::from(&name), |p| {
37+
if p.file_name().is_some() {
38+
p
39+
} else {
40+
p.with_file_name(name.clone())
41+
}
42+
})
43+
.with_extension("toml");
4244

4345
let mut ctx = tera::Context::new();
4446
ctx.insert("name", &name);
4547
let content = tmpl
4648
.render("template", &ctx)
4749
.context("Failed to render template")?;
4850

49-
tokio::fs::write(path, content)
51+
tokio::fs::write(&path, content)
5052
.await
5153
.context("Failed to write data")?;
5254

55+
println!(
56+
"Initialized configuration at path: {}",
57+
path.to_str()
58+
.context("Created file but failed to generate report")?
59+
);
60+
5361
Ok(())
5462
}

0 commit comments

Comments
 (0)