This commit is contained in:
Piyush मिश्रः 2021-02-21 00:26:14 +05:30
parent 7ddec9e47f
commit b924c4abf2
4 changed files with 26 additions and 22 deletions

12
Makefile Normal file
View File

@ -0,0 +1,12 @@
.PHONY: build deploy
help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
build: ## Build static binary and put it in the functions directory.
@cargo build --release
@mkdir -p functions
@cp target/release/lupt functions
deploy: build ## Deploy the site using Netlify's CLI
@netlify deploy --prod

View File

@ -1,2 +0,0 @@
#!/usr/bin/bash
lupt/target/release/lupt -s ./static -a $URL

View File

@ -1,20 +1,4 @@
# example netlify.toml [build]
[build] command = "make build"
command = "cargo build --release" publish = "static"
functions = "functions" functions = "functions"
## Uncomment to use this redirect for Single Page Applications like create-react-app.
## Not needed for static site generators.
#[[redirects]]
# from = "/*"
# to = "/index.html"
# status = 200
## (optional) Settings for Netlify Dev
## https://github.com/netlify/cli/blob/master/docs/netlify-dev.md#project-detection
#[dev]
# command = "yarn start" # Command to start your dev server
# port = 3000 # Port that the dev server will be listening on
# publish = "dist" # Folder with the static content for _redirect file
## more info on configuring this file: https://www.netlify.com/docs/netlify-toml-reference/

View File

@ -7,6 +7,16 @@ pub struct Config {
impl Config { impl Config {
pub fn new() -> Self { pub fn new() -> Self {
let bind_address = std::env::var("URL");
let static_path = std::env::var("STATIC_PATH");
if bind_address.is_ok() && static_path.is_ok() {
return Config {
static_path: static_path.unwrap(),
bind_address: bind_address.unwrap()
};
}
let matches = App::new("Lupt (लुप्त)") let matches = App::new("Lupt (लुप्त)")
.version(env!("CARGO_PKG_VERSION")) .version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS")) .author(env!("CARGO_PKG_AUTHORS"))