OrderingDb ConnectionString in Environment Variable and docker-compose.yml file

This commit is contained in:
Cesar De la Torre 2016-10-06 12:21:18 -07:00
parent 97e83b1f0d
commit 7f73803441
5 changed files with 11 additions and 7 deletions

View File

@ -25,7 +25,7 @@ services:
ordering.api:
image: eshop/ordering.api
environment:
- ConnectionString=TBD
- ConnectionString=Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
ports:
- "81:80"
extra_hosts:

View File

@ -46,9 +46,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
//var connString = @"Server=CESARDLBOOKVHD;Database=Microsoft.eShopOnContainers.Services.OrderingDb;Trusted_Connection=True;";
//(SQL Server Authentication)
var connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;";
//(TBD) connString = config.GetConnectionString("SqlStandardAuthentication.OrderingDb");
//var connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;";
var connString = Configuration["ConnectionString"];
services.AddDbContext<OrderingDbContext>(options => options.UseSqlServer(connString)
.UseSqlServer(connString, b => b.MigrationsAssembly("Ordering.API"))

View File

@ -2,14 +2,15 @@ version: '2'
services:
microsoft.eshoponcontainers.services.ordering.api:
image: username/microsoft.eshoponcontainers.services.ordering.api:Debug
image: eshop/ordering.api:Debug
build:
context: .
dockerfile: Dockerfile.debug
environment:
- REMOTE_DEBUGGING=${REMOTE_DEBUGGING}
- ConnectionString=Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
ports:
- "80:80"
- "81:80"
volumes:
- .:/app
extra_hosts:

View File

@ -4,7 +4,7 @@ services:
ordering.api:
image: eshop/ordering.api
environment:
- ConnectionString=TBD
- ConnectionString=Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
ports:
- "81:80"
extra_hosts:

View File

@ -16,6 +16,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork
public DbSet<Order> Orders { get; set; }
//(CDLTLL) Probably delete, not using it for now
/*
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
//If running from ASP.NET Core, config is done at StartUp.cs --> ConfigureServices() outside
@ -39,6 +41,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork
}
}
*/
protected override void OnModelCreating(ModelBuilder modelBuilder)
{