forked from vieter-v/vieter
Ran vfmt
parent
d11ad78bff
commit
ab72c800c3
|
@ -29,7 +29,7 @@ fn create_build_image() ?string {
|
||||||
cmds_str := base64.encode_str(commands.join('\n'))
|
cmds_str := base64.encode_str(commands.join('\n'))
|
||||||
|
|
||||||
c := docker.NewContainer{
|
c := docker.NewContainer{
|
||||||
image: base_image
|
image: build.base_image
|
||||||
env: ['BUILD_SCRIPT=$cmds_str']
|
env: ['BUILD_SCRIPT=$cmds_str']
|
||||||
entrypoint: ['/bin/sh', '-c']
|
entrypoint: ['/bin/sh', '-c']
|
||||||
cmd: ['echo \$BUILD_SCRIPT | base64 -d | /bin/sh -e']
|
cmd: ['echo \$BUILD_SCRIPT | base64 -d | /bin/sh -e']
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn send_request<T>(method http.Method, address string, url string, api_key strin
|
||||||
if params.len > 0 {
|
if params.len > 0 {
|
||||||
params_str := params.keys().map('$it=${params[it]}').join('&')
|
params_str := params.keys().map('$it=${params[it]}').join('&')
|
||||||
|
|
||||||
full_url = "$full_url?$params_str"
|
full_url = '$full_url?$params_str'
|
||||||
}
|
}
|
||||||
|
|
||||||
mut req := http.new_request(method, full_url, '') ?
|
mut req := http.new_request(method, full_url, '') ?
|
||||||
|
@ -24,7 +24,8 @@ fn send_request<T>(method http.Method, address string, url string, api_key strin
|
||||||
|
|
||||||
// get_repos returns the current list of repos.
|
// get_repos returns the current list of repos.
|
||||||
pub fn get_repos(address string, api_key string) ?map[string]GitRepo {
|
pub fn get_repos(address string, api_key string) ?map[string]GitRepo {
|
||||||
data := send_request<map[string]GitRepo>(http.Method.get, address, '/api/repos', api_key, {}) ?
|
data := send_request<map[string]GitRepo>(http.Method.get, address, '/api/repos', api_key,
|
||||||
|
{}) ?
|
||||||
|
|
||||||
return data.data
|
return data.data
|
||||||
}
|
}
|
||||||
|
@ -32,10 +33,10 @@ pub fn get_repos(address string, api_key string) ?map[string]GitRepo {
|
||||||
// add_repo adds a new repo to the server.
|
// add_repo adds a new repo to the server.
|
||||||
pub fn add_repo(address string, api_key string, url string, branch string, repo string, arch []string) ?Response<string> {
|
pub fn add_repo(address string, api_key string, url string, branch string, repo string, arch []string) ?Response<string> {
|
||||||
params := {
|
params := {
|
||||||
'url': url
|
'url': url
|
||||||
'branch': branch
|
'branch': branch
|
||||||
'repo': repo
|
'repo': repo
|
||||||
'arch': arch.join(',')
|
'arch': arch.join(',')
|
||||||
}
|
}
|
||||||
data := send_request<string>(http.Method.post, address, '/api/repos', api_key, params) ?
|
data := send_request<string>(http.Method.post, address, '/api/repos', api_key, params) ?
|
||||||
|
|
||||||
|
@ -44,7 +45,8 @@ pub fn add_repo(address string, api_key string, url string, branch string, repo
|
||||||
|
|
||||||
// remove_repo removes the repo with the given ID from the server.
|
// remove_repo removes the repo with the given ID from the server.
|
||||||
pub fn remove_repo(address string, api_key string, id string) ?Response<string> {
|
pub fn remove_repo(address string, api_key string, id string) ?Response<string> {
|
||||||
data := send_request<string>(http.Method.delete, address, '/api/repos/$id', api_key, {}) ?
|
data := send_request<string>(http.Method.delete, address, '/api/repos/$id', api_key,
|
||||||
|
{}) ?
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue