29 lines
925 B
C#
29 lines
925 B
C#
using System.CommandLine;
|
|
using MycroForge.CLI.Commands.Interfaces;
|
|
|
|
namespace MycroForge.CLI.Commands;
|
|
|
|
public partial class MycroForge
|
|
{
|
|
public partial class Db
|
|
{
|
|
public partial class Run : Command, ISubCommandOf<Db>
|
|
{
|
|
private readonly ProjectContext _context;
|
|
|
|
public Run(ProjectContext context) :
|
|
base("run", $"Runs {Features.Db.FeatureName}.docker-compose.yml")
|
|
{
|
|
_context = context;
|
|
this.SetHandler(ExecuteAsync);
|
|
}
|
|
|
|
private async Task ExecuteAsync()
|
|
{
|
|
var config = await _context.LoadConfig();
|
|
var env = $"DB_PORT={config.Db.DbPort} PMA_PORT={config.Db.PmaPort}";
|
|
await _context.Bash($"{env} docker compose -f {Features.Db.FeatureName}.docker-compose.yml up -d");
|
|
}
|
|
}
|
|
}
|
|
} |