File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 8686 } ;
8787
8888 packages = {
89+ run-stack = pkgs . writeShellApplication {
90+ name = "run-stack" ;
91+ runtimeInputs = [
92+ pkgs . tinyproxy
93+ pkgs . simple-http-server
94+ ] ;
95+ text =
96+ let
97+ proxyConfig = pkgs . writeTextFile {
98+ name = "proxy.conf" ;
99+ text = ''
100+ ReversePath "/" "http://0.0.0.0:8001/"
101+ ReversePath "/api/" "http://0.0.0.0:8002/api/"
102+ ReverseOnly Yes
103+ Port 8000
104+ ReverseBaseURL "http://0.0.0.0:8000/"
105+ '' ;
106+ } ;
107+ in
108+ ''
109+ simple-http-server --index --port 8001 frontend &
110+ PID_FRONTEND=$!
111+ cargo run -- --listen-address 0.0.0.0:8002 &
112+ PID_BACKEND=$!
113+ tinyproxy -d -c ${ proxyConfig } &
114+ PID_PROXY=$!
115+
116+ cleanup() {
117+ kill $PID_FRONTEND $PID_BACKEND $PID_PROXY
118+ wait $PID_FRONTEND $PID_BACKEND $PID_PROXY
119+ exit 0
120+ }
121+
122+ trap cleanup SIGINT
123+
124+ wait $PID_FRONTEND $PID_BACKEND $PID_PROXY
125+ '' ;
126+ } ;
127+
89128 server-deps = craneLib . buildDepsOnly commonAttrs ;
90129
91130 server-docs = craneLib . cargoDoc (
You can’t perform that action at this time.
0 commit comments