Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor into individual executables #48

Merged
merged 12 commits into from Mar 23, 2015
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -19,6 +19,7 @@ _cgo_export.*

_testmain.go

*.swp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be *.sw?, sometimes Vim creates .swo, .swm, etc.

*.exe
*.test
*.prof
Expand Down
34 changes: 34 additions & 0 deletions cmd/boulder-ca/main.go
@@ -0,0 +1,34 @@
// Copyright 2014 ISRG. All rights reserved
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package main

import (
"github.com/letsencrypt/boulder/ca"
"github.com/letsencrypt/boulder/cmd"
"github.com/letsencrypt/boulder/rpc"
)

func main() {
app := cmd.NewAppShell("boulder-ca")
app.Action = func(c cmd.Config) {
ch := cmd.AmqpChannel(c.AMQP.Server)

sac, err := rpc.NewStorageAuthorityClient(c.AMQP.SA.Client, c.AMQP.SA.Client, ch)
cmd.FailOnError(err, "Failed to create SA client")

cai, err := ca.NewCertificateAuthorityImpl(c.CA.Server, c.CA.AuthKey, c.CA.Profile)
cmd.FailOnError(err, "Failed to create CA impl")

cai.SA = &sac

cas, err := rpc.NewCertificateAuthorityServer(c.AMQP.CA.Server, ch, cai)
cmd.FailOnError(err, "Unable to create CA server")

cmd.RunForever(cas)
}

app.Run()
}
39 changes: 39 additions & 0 deletions cmd/boulder-ra/main.go
@@ -0,0 +1,39 @@
// Copyright 2014 ISRG. All rights reserved
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package main

import (
"github.com/letsencrypt/boulder/cmd"
"github.com/letsencrypt/boulder/ra"
"github.com/letsencrypt/boulder/rpc"
)

func main() {
app := cmd.NewAppShell("boulder-sa")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: boulder-ra

app.Action = func(c cmd.Config) {
ch := cmd.AmqpChannel(c.AMQP.Server)

vac, err := rpc.NewValidationAuthorityClient(c.AMQP.VA.Client, c.AMQP.VA.Server, ch)
cmd.FailOnError(err, "Unable to create VA client")

cac, err := rpc.NewCertificateAuthorityClient(c.AMQP.CA.Client, c.AMQP.CA.Server, ch)
cmd.FailOnError(err, "Unable to create CA client")

sac, err := rpc.NewStorageAuthorityClient(c.AMQP.SA.Client, c.AMQP.SA.Server, ch)
cmd.FailOnError(err, "Unable to create SA client")

rai := ra.NewRegistrationAuthorityImpl()
rai.VA = &vac
rai.CA = &cac
rai.SA = &sac

ras, err := rpc.NewRegistrationAuthorityServer(c.AMQP.RA.Server, ch, &rai)
cmd.FailOnError(err, "Unable to create RA server")
cmd.RunForever(ras)
}

app.Run()
}
31 changes: 31 additions & 0 deletions cmd/boulder-sa/main.go
@@ -0,0 +1,31 @@
// Copyright 2014 ISRG. All rights reserved
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package main

import (
// Load both drivers to allow configuring either
_ "github.com/go-sql-driver/mysql"
_ "github.com/mattn/go-sqlite3"

"github.com/letsencrypt/boulder/cmd"
"github.com/letsencrypt/boulder/rpc"
"github.com/letsencrypt/boulder/sa"
)

func main() {
app := cmd.NewAppShell("boulder-sa")
app.Action = func(c cmd.Config) {
ch := cmd.AmqpChannel(c.AMQP.Server)

sai, err := sa.NewSQLStorageAuthority(c.SA.DBDriver, c.SA.DBName)
cmd.FailOnError(err, "Failed to create SA impl")

sas := rpc.NewStorageAuthorityServer(c.AMQP.SA.Server, ch, sai)
cmd.RunForever(sas)
}

app.Run()
}