Fix small issues

This commit is contained in:
Adrian Woźniak 2021-10-08 09:38:10 +02:00
parent a13678d98f
commit 09e941ff8a
No known key found for this signature in database
GPG Key ID: DE43476F72AD3F6C
3 changed files with 18 additions and 11 deletions

View File

@ -1,6 +1,9 @@
#![feature(format_args_capture)] #![feature(format_args_capture)]
fn main() { fn main() {
if std::fs::metadata("./src/location.rs").is_ok() {
return;
}
if let Ok(contents) = std::fs::read_to_string("../.env") { if let Ok(contents) = std::fs::read_to_string("../.env") {
for line in contents.lines() { for line in contents.lines() {
if line.starts_with('#') { if line.starts_with('#') {
@ -14,14 +17,14 @@ fn main() {
} }
} }
let addr = std::env::var("JIRS_SERVER_BIND").unwrap_or("0.0.0.0".to_string()); let addr = std::env::var("JIRS_SERVER_BIND").unwrap_or_else(|_| "0.0.0.0".to_string());
let addr = if addr.as_str() == "0.0.0.0" || addr.as_str() == "localhost" { let addr = if addr.as_str() == "0.0.0.0" || addr.as_str() == "localhost" {
"localhost" "localhost"
} else { } else {
addr.as_str() addr.as_str()
} }
.to_string(); .to_string();
let port = std::env::var("JIRS_SERVER_PORT").unwrap_or("80".to_string()); let port = std::env::var("JIRS_SERVER_PORT").unwrap_or_else(|_| "80".to_string());
let port = match port.as_str() { let port = match port.as_str() {
"80" | "8080" | "443" => "".to_string(), "80" | "8080" | "443" => "".to_string(),
_ => format!(":{}", port), _ => format!(":{}", port),

View File

@ -1,7 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
which rsass export JIRS_SERVER_BIND=jirs.ita-prog.pl;
if [[ "$status" != "0" ]]; then export JIRS_SERVER_PORT=443;
RSASS_PATH=$(command -v rsass)
if [[ "${RSASS_PATH}" == "" ]]; then
cargo install rsass --features=commandline cargo install rsass --features=commandline
fi fi
@ -17,18 +20,19 @@ rm -Rf build
mkdir build mkdir build
cd $CLIENT_ROOT cd $CLIENT_ROOT
wasm-pack build --mode normal --release --out-name jirs --out-dir $CLIENT_ROOT/build --target web wasm-pack build --mode normal --release --out-name jirs --out-dir ${CLIENT_ROOT}/build --target web
# wasm-pack build --mode normal --dev --out-name jirs --out-dir ${CLIENT_ROOT}/build --target web
cd $HI_ROOT #cd $HI_ROOT
wasm-pack build --mode normal --release --out-name hi --out-dir $CLIENT_ROOT/build --target web #wasm-pack build --mode normal --release --out-name hi --out-dir ${CLIENT_ROOT}/build --target web
cd $CLIENT_ROOT cd $CLIENT_ROOT
rm -Rf ${CLIENT_ROOT}/build/styles.css rm -Rf ${CLIENT_ROOT}/build/styles.css
rsass -t Compressed ${PROJECT_ROOT}/web/js/styles.css > ${CLIENT_ROOT}/build/styles.css rsass -t Compressed ${PROJECT_ROOT}/web/js/styles.css > ${CLIENT_ROOT}/build/styles.css
cp -r ./static/* ./build cp -r ${CLIENT_ROOT}/static/* ${CLIENT_ROOT}/build
cat ./static/index.js | cat ./static/index.js |
sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" | sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" |
sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &>./build/index.js sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> ${CLIENT_ROOT}/build/index.js
cp ./js/template.html ./build/index.html cp ${CLIENT_ROOT}/js/template.html ${CLIENT_ROOT}/build/index.html

View File

@ -1,4 +1,4 @@
#![feature(type_ascription, trait_alias, drain_filter, or_patterns)] #![feature(type_ascription, trait_alias, drain_filter)]
pub use changes::*; pub use changes::*;
pub use components::*; pub use components::*;