コード例 #1
0
        public SettingsEndpoint(AppSettings settings)
            : base("/settings")
        {
            _settings = settings;

            Get["/"] = _ => _settings;
        }
コード例 #2
0
 public DcsScm(AppSettings settings, DcsFilesystem dcsFiles, Users users, ScmClient scm)
 {
     _settings = settings;
     _dcsFiles = dcsFiles;
     _users = users;
     _scm = scm;
 }
コード例 #3
0
 public SolutionRunner(ILog log, AppSettings settings, PortReservations reservations, Shell shell)
 {
     _log = log;
     _settings = settings;
     _reservations = reservations;
     _shell = shell;
 }
コード例 #4
0
        public static IBus ReGisterReBusBus(
            this IContainer container, 
            AppSettings settings, 
            string applicationName)
        {
            string inputQueue = applicationName + ".input";
            string errorQueue = applicationName + ".error";

            var adapter = new AutofacContainerAdapter(container);
            var bus = Configure.With(adapter)
                .Logging(l => l.Log4Net())
                .Transport(t => t.UseSqlServer(settings.Env.DcsDbConn,
                    "BusTransport",
                    inputQueue,
                    errorQueue)
                    .EnsureTableIsCreated())
                .Serialization(s => s.UseJsonSerializer())
                .MessageOwnership(m => m.Use(new SingleDestinationMessageOwnership(inputQueue)))
                .Subscriptions(s =>
                    s.StoreInSqlServer(settings.Env.DcsDbConn, "BusSubscription")
                        .EnsureTableIsCreated())
                .Behavior(b => b.SetMaxRetriesFor<Exception>(1))
                .CreateBus()
                .Start();

            return bus;
        }
コード例 #5
0
        static void Main(string[] args)
        {
            HostFactory.Run(configure =>
            {
                configure.Service<DcsUserServicesApp>(s =>
                {
                    s.ConstructUsing(name => new DcsUserServicesApp());
                    s.WhenStarted(sh => sh.Start());
                    s.WhenStopped(sh => sh.Stop());
                });

                var settings = new AppSettings();
                configure.MustUseLog4Net("dcs.userServices.log4net.config");
                configure.RunAs(
                    @"{0}\{1}".FormatWith(Environment.MachineName, settings.Env.SolutionExecUsername), 
                    settings.Env.SolutionExecPassword);

                configure.SetDescription("CodeFlight Design Services User Host");
                configure.SetDisplayName("DCS.UserServices");
                configure.SetServiceName("DCS.UserServices");
            });
        }
コード例 #6
0
 public DcsWebServicesApi(AppSettings settings, ILog log)
 {
     _settings = settings;
     _log = log;
 }
コード例 #7
0
 public KillOrphansOperation(AppSettings settings, ILog log)
 {
     _settings = settings;
     _log = log;
 }
コード例 #8
0
 public PortReservations(AppSettings settings, ILog log)
 {
     _settings = settings;
     _log = log;
 }
コード例 #9
0
        public UsersEndpoint(Users users, Commits commits, AppSettings settings, DcsScm scm)
            : base("/users")
        {
            Get["/"] = _ =>
            {
                string token = Request.Query.token;
                if (token.ToNullableGuid() != FakeyAuth.Token)
                {
                    return new Response
                    {
                        StatusCode = HttpStatusCode.Forbidden
                    };
                }

                return users.GetAll()
                    .Select(u =>
                    {
                        var user = new
                        {
                            Username = u.Username,
                            u.Id
                        };

                        return user;
                    }
                    );
            };

            Get["/{userId}"] = _ =>
            {
                var user = users.Get((Guid) _.userId);
                if (user == null)
                {
                    return new NotFoundResponse();
                }
                var repo = user.Repositories.FirstOrDefault();
                return new
                {
                    Username = user.Username,
                    user.Id,
                    user.Email,
                    RepositoryHref = repo == null ? null : scm.GetRepoUrl(repo.Name, user, true),
                    Challenges = user.Challenges.Select(c =>
                    new {
                        c.Name,
                        c.StageNumber,
                        c.RepositoryId
                    })
                };
            };

            Get["/{userId}/commits"] = _ =>
                commits.ForUser((Guid) _.userId)
                    .OrderByDescending(c => c.CommittedAt)
                    .Select(c =>
                        new
                        {
                            c.Id,
                            c.CommittedAt,
                            c.UserId,
                            c.Username,
                            c.RepositoryId,
                            c.RepositoryName,
                            c.Challenge,
                            c.CurrentStageNumber,
                            c.ResultsUpdatedAt,
                            c.Outcome,
                            c.OutcomeDetail,
                            HasTestOutput = !string.IsNullOrEmpty(c.TestOutput)
                        });
        }
コード例 #10
0
 public CheckRubyEnvOperation(AppSettings settings, Shell shell, ILog log)
 {
     _settings = settings;
     _shell = shell;
     _log = log;
 }
コード例 #11
0
 public DcsHrefs(AppSettings appSettings)
 {
     _appSettings = appSettings;
 }