Skip to content

Commit

Permalink
Merge branch 'main' into STAGING
Browse files Browse the repository at this point in the history
  • Loading branch information
ctcac00 committed Nov 27, 2024
2 parents 4ef6fe6 + bdc848f commit dc75d50
Show file tree
Hide file tree
Showing 22 changed files with 2,134 additions and 46 deletions.
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
rest_service:
build: ./rest_service/
ports:
- "8000:80"
volumes:
- ./rest_service/.env:/publish/.env

website:
build: ./website/
ports:
- "80:80"
volumes:
- ./website/.env:/publish/.env
1 change: 1 addition & 0 deletions rest_service/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet 7.0.410
16 changes: 13 additions & 3 deletions rest_service/Controllers/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@ public BaseController(ILogger<BaseController> logger)
Logger = logger;
DotEnv.Load();
var envVars = DotEnv.Read();
var connectionString = envVars[Constants.ConnectionStringKey];
var databaseName = envVars[Constants.DatabaseNameKey];

String connectionString;
String databaseName;

if(envVars.Count > 0) {
connectionString = envVars[Constants.ConnectionStringKey];
databaseName = envVars[Constants.DatabaseNameKey];
} else {
connectionString = System.Environment.GetEnvironmentVariable(Constants.ConnectionStringKey);
databaseName = System.Environment.GetEnvironmentVariable(Constants.DatabaseNameKey);
}

Client = new MongoClient(connectionString);
Database = Client.GetDatabase(databaseName);
}
}
}
}
14 changes: 14 additions & 0 deletions rest_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# syntax=docker/dockerfile:1

FROM mcr.microsoft.com/dotnet/sdk:7.0 as build-env
WORKDIR /src
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /publish

FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime
WORKDIR /publish
COPY --from=build-env /publish .
EXPOSE 80
ENTRYPOINT ["dotnet", "RestService.dll"]
37 changes: 37 additions & 0 deletions terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore transient lock info files created by terraform apply
.terraform.tfstate.lock.info

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc
25 changes: 25 additions & 0 deletions terraform/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dc75d50

Please sign in to comment.