forked from vieter-v/vieter
Compare commits
2 Commits
3f442d7290
...
2a4f0654ea
| Author | SHA1 | Date |
|---|---|---|
|
|
2a4f0654ea | |
|
|
2fea78a6f8 |
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Moved all API routes under `/v1` namespace
|
* Moved all API routes under `/v1` namespace
|
||||||
|
* Server port can now be configured
|
||||||
|
|
||||||
## [0.3.0](https://git.rustybever.be/vieter/vieter/src/tag/0.3.0)
|
## [0.3.0](https://git.rustybever.be/vieter/vieter/src/tag/0.3.0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ pub fn (c &Client) get_targets(filter TargetFilter) ?[]Target {
|
||||||
return data.data
|
return data.data
|
||||||
}
|
}
|
||||||
|
|
||||||
// get_all_targets retrieves *all* targs from the API using the default
|
// get_all_targets retrieves *all* targets from the API using the default
|
||||||
// limit.
|
// limit.
|
||||||
pub fn (c &Client) get_all_targets() ?[]Target {
|
pub fn (c &Client) get_all_targets() ?[]Target {
|
||||||
mut targets := []Target{}
|
mut targets := []Target{}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Bindings for the libarchive library
|
// Bindings for the libarchive library
|
||||||
|
module package
|
||||||
|
|
||||||
#flag -larchive
|
#flag -larchive
|
||||||
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
module server
|
||||||
|
|
||||||
|
import io.util
|
||||||
|
import os
|
||||||
|
|
||||||
|
fn test_targets_api() ? {
|
||||||
|
// Create a database
|
||||||
|
|
||||||
|
// Start the server in a temporary directory
|
||||||
|
tmpdir := util.temp_dir()?
|
||||||
|
go server.server(
|
||||||
|
data_dir: tmpdir
|
||||||
|
pkg_dir: os.join_path_single(tmpdir, 'pkgs')
|
||||||
|
api_key: 't'
|
||||||
|
port: 9000
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ pub:
|
||||||
data_dir string
|
data_dir string
|
||||||
api_key string
|
api_key string
|
||||||
default_arch string
|
default_arch string
|
||||||
|
port int = 8000
|
||||||
}
|
}
|
||||||
|
|
||||||
// cmd returns the cli submodule that handles starting the server
|
// cmd returns the cli submodule that handles starting the server
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import util
|
||||||
import db
|
import db
|
||||||
|
|
||||||
const (
|
const (
|
||||||
port = 8000
|
|
||||||
log_file_name = 'vieter.log'
|
log_file_name = 'vieter.log'
|
||||||
repo_dir_name = 'repos'
|
repo_dir_name = 'repos'
|
||||||
db_file_name = 'vieter.sqlite'
|
db_file_name = 'vieter.sqlite'
|
||||||
|
|
@ -77,5 +76,5 @@ pub fn server(conf Config) ? {
|
||||||
conf: conf
|
conf: conf
|
||||||
repo: repo
|
repo: repo
|
||||||
db: db
|
db: db
|
||||||
}, server.port)
|
}, conf.port)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue