mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-23 17:19:47 +02:00
add new domain name
This commit is contained in:
10
get/Makefile
Normal file
10
get/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
BUILDDIR = ../build/get
|
||||
|
||||
copyfiles = router.lua shs
|
||||
main:
|
||||
- mkdir -p $(BUILDDIR)
|
||||
cp -rf $(copyfiles) $(BUILDDIR)
|
||||
- cd $(BUILDDIR) && ln -s ../grs ./rst
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
55
get/router.lua
Normal file
55
get/router.lua
Normal file
@ -0,0 +1,55 @@
|
||||
|
||||
-- the rewrite rule for the framework
|
||||
-- should be something like this
|
||||
-- ^\/apps\/+(.*)$ = /apps/router.lua?r=<1>&<query>
|
||||
-- some global variables
|
||||
DIR_SEP = "/"
|
||||
WWW_ROOT = "/opt/www/htdocs/get"
|
||||
HTTP_ROOT = "https://get.makeand.run"
|
||||
-- class path: path.to.class
|
||||
BASE_FRW = ""
|
||||
-- class path: path.to.class
|
||||
CONTROLLER_ROOT = BASE_FRW.."apps.controllers"
|
||||
MODEL_ROOT = BASE_FRW.."apps.models"
|
||||
-- file path: path/to/file
|
||||
VIEW_ROOT = WWW_ROOT..DIR_SEP.."views"
|
||||
LOG_ROOT = WWW_ROOT..DIR_SEP.."logs"
|
||||
|
||||
-- require needed library
|
||||
require(BASE_FRW.."silk.api")
|
||||
|
||||
function NotfoundController:index(...)
|
||||
local args = {...}
|
||||
local name = args[1] or nil
|
||||
if not name then
|
||||
return self:error("Unknown script")
|
||||
end
|
||||
name = name:gsub("Controller",""):lower()
|
||||
local path = WWW_ROOT..DIR_SEP.."shs"..DIR_SEP..name..".sh"
|
||||
|
||||
if ulib.exists(path) then
|
||||
std.header("text/plain")
|
||||
std.f(path)
|
||||
else
|
||||
self:error("No script found: "..path)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- registry object store global variables
|
||||
local REGISTRY = {}
|
||||
-- set logging level
|
||||
REGISTRY.logger = Logger:new{ levels = {INFO = false, ERROR = false, DEBUG = false}}
|
||||
|
||||
REGISTRY.layout = 'default'
|
||||
REGISTRY.fileaccess = false
|
||||
|
||||
local router = Router:new{registry = REGISTRY}
|
||||
REGISTRY.router = router
|
||||
router:setPath(CONTROLLER_ROOT)
|
||||
--router:route('edit', 'post/edit', "ALL" )
|
||||
|
||||
router:route('default', default_routes_dependencies )
|
||||
router:delegate()
|
||||
|
57
get/shs/antd.sh
Normal file
57
get/shs/antd.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#! /bin/bash
|
||||
echo "AND auto build script"
|
||||
if [ -d "ant-http" ]; then
|
||||
echo "Updating Antd source..."
|
||||
cd "ant-http"
|
||||
git stash
|
||||
git pull
|
||||
else
|
||||
echo "Getting Antd..."
|
||||
git clone https://github.com/lxsang/ant-http
|
||||
cd "ant-http"
|
||||
fi
|
||||
[[ -d "plugins" ]] || mkdir "plugins"
|
||||
echo "getting plugins..."
|
||||
cd "plugins"
|
||||
|
||||
for plugin in $1; do
|
||||
echo "Getting plugin: $plugin..."
|
||||
if [ -d "antd-$plugin-plugin" ]; then
|
||||
echo "Updating $plugin source..."
|
||||
cd "antd-$plugin-plugin"
|
||||
git pull
|
||||
cd ../
|
||||
else
|
||||
echo "Getting $plugin..."
|
||||
git clone "https://github.com/lxsang/antd-$plugin-plugin"
|
||||
fi
|
||||
done
|
||||
cd ../
|
||||
# ask user for some custom setting
|
||||
read -p "Build to (absolute path):" build_dir </dev/tty
|
||||
[[ -d "$build_dir" ]] || mkdir -p "$build_dir"
|
||||
[[ -d "$build_dir/htdocs" ]] || mkdir -p "$build_dir/htdocs"
|
||||
[[ -d "$build_dir/database" ]] || mkdir -p "$build_dir/database"
|
||||
[[ -d "$build_dir/tmp" ]] || mkdir -p "$build_dir/tmp"
|
||||
escape="${build_dir//\//\\/}"
|
||||
escape="${escape//\./\\.}"
|
||||
read -p "Default HTTP port : " http_port </dev/tty
|
||||
cmd="sed -i -E 's/[^P]BUILDIRD=.*/BUILDIRD=$escape/' var.mk"
|
||||
eval $cmd
|
||||
echo
|
||||
make && make antd_plugins
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "[SERVER]" > "$build_dir/config.ini"
|
||||
echo "port=$http_port" >> "$build_dir/config.ini"
|
||||
echo "plugins=$build_dir/plugins/" >> "$build_dir/config.ini"
|
||||
echo "plugins_ext=.dylib" >> "$build_dir/config.ini"
|
||||
echo "database=$build_dir/database/" >> "$build_dir/config.ini"
|
||||
echo "htdocs=$build_dir/htdocs/" >> "$build_dir/config.ini"
|
||||
echo "tmpdir=$build_dir/tmp/" >> "$build_dir/config.ini"
|
||||
echo "ssl.enable=0" >> "$build_dir/config.ini"
|
||||
chmod u+x "$build_dir/antd"
|
||||
echo "Build done, to run the server, execute the command:"
|
||||
echo "$build_dir/antd"
|
||||
else
|
||||
echo "FAIL to build, please check dependencies"
|
||||
fi
|
Reference in New Issue
Block a user