initial commit

This commit is contained in:
mwiegand 2021-11-17 18:02:58 +01:00
commit bbf1f031d0
6 changed files with 57 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
lib

5
README.md Normal file
View file

@ -0,0 +1,5 @@
```sh
shard install
STRATEGIES_DIR=test crystal build-server-crystal.cr --port 4000
curl -X POST "localhost:4000/strategy?file=build-server-crystal.cr" -H "Content-Type: application/json" --data '{"a":1}'
```

18
build-server-crystal.cr Normal file
View file

@ -0,0 +1,18 @@
require "kemal"
strategies_dir = ENV.fetch("STRATEGIES_DIR")
post "/:strategy" do |env|
stdout = IO::Memory.new
Process.run(
"#{strategies_dir}/#{env.params.url["strategy"]}",
[
env.params.query.to_h.to_json,
env.params.json.to_json
],
output: stdout,
)
stdout.to_s
end
Kemal.run

22
shard.lock Normal file
View file

@ -0,0 +1,22 @@
version: 2.0
shards:
backtracer:
git: https://github.com/sija/backtracer.cr.git
version: 1.2.1
exception_page:
git: https://github.com/crystal-loot/exception_page.git
version: 0.2.0
kemal:
git: https://github.com/kemalcr/kemal.git
version: 1.1.0
kilt:
git: https://github.com/jeromegn/kilt.git
version: 0.6.1
radix:
git: https://github.com/luislavena/radix.git
version: 0.4.1

8
shard.yml Normal file
View file

@ -0,0 +1,8 @@
name: build-server-crystal
version: 0.1.0
dependencies:
kemal:
github: kemalcr/kemal
license: MIT

3
test/strategy Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env sh
echo "hello world!"