From fcdcf9c5ca0985c9fbaded2e9580e3f5c90b79dc Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Wed, 15 Jun 2022 12:10:58 +0200 Subject: [PATCH] feat(server): add config option for server port --- CHANGELOG.md | 6 ++++++ docs/content/configuration.md | 3 ++- src/server/cli.v | 1 + src/server/server.v | 3 +-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9adee07..5fe1de7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://git.rustybever.be/vieter/vieter/src/branch/dev) +### Added + +* Server port can now be configured + ### Changed * Moved all API routes under `/v1` namespace +* Renamed `vieter repos` to `vieter targets` +* Renamed `/v1/api/repos` namespace to `/v1/api/targets` ## [0.3.0](https://git.rustybever.be/vieter/vieter/src/tag/0.3.0) diff --git a/docs/content/configuration.md b/docs/content/configuration.md index 600c6f3..f4bf964 100644 --- a/docs/content/configuration.md +++ b/docs/content/configuration.md @@ -45,7 +45,8 @@ configuration variable required for each command. This prevents the server from being confused when an `any` package is published as the very first package for a repository. * Git repositories added without an `arch` value use this value instead. - +* `port`: HTTP port to run on + * Default: `8000` ### `vieter cron` diff --git a/src/server/cli.v b/src/server/cli.v index 53393f7..a62f56e 100644 --- a/src/server/cli.v +++ b/src/server/cli.v @@ -10,6 +10,7 @@ pub: data_dir string api_key string default_arch string + port int = 8000 } // cmd returns the cli submodule that handles starting the server diff --git a/src/server/server.v b/src/server/server.v index 2309ee7..1a9df3f 100644 --- a/src/server/server.v +++ b/src/server/server.v @@ -8,7 +8,6 @@ import util import db const ( - port = 8000 log_file_name = 'vieter.log' repo_dir_name = 'repos' db_file_name = 'vieter.sqlite' @@ -77,5 +76,5 @@ pub fn server(conf Config) ? { conf: conf repo: repo db: db - }, server.port) + }, conf.port) }