Moved config structs to more logical location
Some checks failed
ci/woodpecker/push/arch unknown status
ci/woodpecker/push/deploy unknown status
ci/woodpecker/push/docker unknown status
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Jef Roosens 2022-04-06 18:20:14 +02:00
parent 2aa2aa143c
commit c656e672e2
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
5 changed files with 23 additions and 25 deletions

View file

@ -3,7 +3,6 @@ module build
import docker
import encoding.base64
import time
import env
import net.http
import git
import json
@ -62,7 +61,7 @@ fn create_build_image() ?string {
return image.id
}
fn build(conf env.BuildConfig) ? {
fn build(conf Config) ? {
// We get the repos list from the Vieter instance
mut req := http.new_request(http.Method.get, '$conf.address/api/repos', '') ?
req.add_custom_header('X-Api-Key', conf.api_key) ?

View file

@ -3,6 +3,12 @@ module build
import cli
import env
pub struct Config {
pub:
api_key string
address string
}
// cmd returns the cli submodule that handles the build process
pub fn cmd() cli.Command {
return cli.Command{
@ -10,7 +16,7 @@ pub fn cmd() cli.Command {
description: 'Run the build process.'
execute: fn (cmd cli.Command) ? {
config_file := cmd.flags.get_string('config-file') ?
conf := env.load<env.BuildConfig>(config_file) ?
conf := env.load<Config>(config_file) ?
build(conf) ?
}