Skip to content

Commit

Permalink
Merge pull request #2 from ccsapp/move-to-github
Browse files Browse the repository at this point in the history
Move to GitHub
  • Loading branch information
ytausch authored Jul 1, 2023
2 parents 1aafc51 + 33e96ee commit e96b098
Show file tree
Hide file tree
Showing 23 changed files with 249 additions and 387 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

defaults:
run:
working-directory: ./src

jobs:
build-and-test:
runs-on: ubuntu-latest
env:
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }}
MONGODB_DATABASE_NAME: ${{ vars.MONGODB_DATABASE_NAME }}
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Go Generate
run: go generate -v ./...

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

- name: Upload Sequence Diagrams
uses: actions/upload-artifact@v3
with:
name: sequence-diagrams
path: ./src/.sequence/
26 changes: 0 additions & 26 deletions .gitlab-ci.yml

This file was deleted.

23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
Car is a domain layer microservice of CCSAppVP2 that provides static and dynamic car data.

Since the models that Car uses are also needed in other microservices they were extracted to a separate repository.
The models are available at the private Git repository
[CarGoTypes](https://git.scc.kit.edu/cm-tm/cm-team/projectwork/pse/domain/d-cargotypes) to provide mappings for the
JSON responses.
Further information on the usage of private Git repositories with go can be found there.
The models are available at
[cargotypes](https://github.com/ccsapp/cargotypes) to provide mappings for the JSON responses.

The provided API endpoints of Car are specified in the
[API specification](https://git.scc.kit.edu/cm-tm/cm-team/projectwork/pse/domain/d-cardesign/-/blob/main/openapi.yaml).
[API specification](https://github.com/ccsapp/CarDesign/blob/main/openapi.yaml).

## Local Setup Mode
To run the microservice Car locally, you can use the MongoDB setup provided in the `dev` directory.
Expand Down Expand Up @@ -51,15 +49,12 @@ correct docker compose stack is running and will print a warning if it is not.
Do not use the local setup mode in a deployment or a custom setup, i.e. do not set the `CAR_LOCAL_SETUP` environment
variable. Instead, use the following environment variables to configure the microservice:

| Environment Variable | Local Setup Value | Comment |
|-----------------------------|-------------------|-----------------------------------------------------------------------------------------------------------------------|
| `MONGODB_DATABASE_HOST` | localhost | |
| `MONGODB_DATABASE_PORT` | 27021 | Optional, defaults to 27017. The local setup uses a non-default port! |
| `MONGODB_DATABASE_NAME` | ccsappvp2car | |
| `MONGODB_DATABASE_USER` | root | |
| `MONGODB_DATABASE_PASSWORD` | example | |
| `CAR_EXPOSE_PORT` | 8001 | Optional, defaults to 80. This is the port this microservice is exposing. The local setup exposes a non-default port! |
| `CAR_COLLECTION_PREFIX` | localSetup- | Optional. A (unique) prefix that is prepended to every database collection of this service. |
| Environment Variable | Local Setup Value | Comment |
|-----------------------------|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| `MONGODB_CONNECTION_STRING` | mongodb://root:example@localhost:27021/ccsappvp2car | |
| `MONGODB_DATABASE_NAME` | ccsappvp2car | |
| `CAR_EXPOSE_PORT` | 8001 | Optional, defaults to 80. This is the port this microservice is exposing. The local setup exposes a non-default port! |
| `CAR_COLLECTION_PREFIX` | localSetup- | Optional. A (unique) prefix that is prepended to every database collection of this service. |

## Testing

Expand Down
2 changes: 0 additions & 2 deletions helm/.env

This file was deleted.

22 changes: 0 additions & 22 deletions helm/.helmignore

This file was deleted.

26 changes: 0 additions & 26 deletions helm/Chart.yaml

This file was deleted.

142 changes: 0 additions & 142 deletions helm/values.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/api/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package api

import (
"DCar/infrastructure/database"
carTypes "git.scc.kit.edu/cm-tm/cm-team/projectwork/pse/domain/d-cargotypes.git"
carTypes "github.com/ccsapp/cargotypes"
"github.com/labstack/echo/v4"
"net/http"
)
Expand Down
2 changes: 1 addition & 1 deletion src/api/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"DCar/mocks"
"context"
"errors"
carTypes "git.scc.kit.edu/cm-tm/cm-team/projectwork/pse/domain/d-cargotypes.git"
carTypes "github.com/ccsapp/cargotypes"
openapiTypes "github.com/deepmap/oapi-codegen/pkg/types"
"github.com/golang/mock/gomock"
"github.com/labstack/echo/v4"
Expand Down
2 changes: 1 addition & 1 deletion src/api/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package api

import (
"fmt"
carTypes "git.scc.kit.edu/cm-tm/cm-team/projectwork/pse/domain/d-cargotypes.git"
carTypes "github.com/ccsapp/cargotypes"
"net/http"

"github.com/deepmap/oapi-codegen/pkg/runtime"
Expand Down
29 changes: 7 additions & 22 deletions src/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,21 @@ func GetEnvironment() *Environment {
}

type Environment struct {
mongoDbHost string
mongoDbPort int
mongoDbDatabase string
mongoDbUser string
mongoDbPassword string
appExposePort int
appCollectionPrefix string
isLocalSetupMode bool
mongoDbConnectionString string
mongoDbDatabase string
appExposePort int
appCollectionPrefix string
isLocalSetupMode bool
}

func (e *Environment) GetMongoDbHost() string {
return e.mongoDbHost
}

func (e *Environment) GetMongoDbPort() int {
return e.mongoDbPort
func (e *Environment) GetMongoDbConnectionString() string {
return e.mongoDbConnectionString
}

func (e *Environment) GetMongoDbDatabase() string {
return e.mongoDbDatabase
}

func (e *Environment) GetMongoDbUser() string {
return e.mongoDbUser
}

func (e *Environment) GetMongoDbPassword() string {
return e.mongoDbPassword
}

func (e *Environment) GetAppExposePort() int {
return e.appExposePort
}
Expand Down
5 changes: 1 addition & 4 deletions src/environment/localSetup.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
MONGODB_DATABASE_HOST=localhost
MONGODB_DATABASE_PORT=27021
MONGODB_CONNECTION_STRING=mongodb://root:example@localhost:27021/ccsappvp2car
MONGODB_DATABASE_NAME=ccsappvp2car
MONGODB_DATABASE_USER=root
MONGODB_DATABASE_PASSWORD=example
CAR_EXPOSE_PORT=8001
CAR_COLLECTION_PREFIX=localSetup-
Loading

0 comments on commit e96b098

Please sign in to comment.