Allow to specify custom software name and version (#94)

In turn, this allows us to identify as ooniprobe-cli v3.0.0-rc.5.

Closes #41.
This commit is contained in:
Simone Basso 2019-12-29 14:07:57 +01:00 committed by GitHub
commit 1e8b482c23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 7 deletions

View file

@ -12,7 +12,6 @@ import (
"github.com/ooni/probe-cli/internal/enginex"
"github.com/ooni/probe-cli/internal/legacy"
"github.com/ooni/probe-cli/utils"
"github.com/ooni/probe-cli/version"
engine "github.com/ooni/probe-engine"
"github.com/pkg/errors"
"upper.io/db.v3/lib/sqlbuilder"
@ -48,12 +47,13 @@ func (c *Context) IsTerminated() bool {
return i != 0
}
// Terminate interrupts the running context
func (c *Context) Terminate() {
atomic.AddInt64(&c.isTerminatedAtomicInt, 1)
}
// Init the OONI manager
func (c *Context) Init() error {
func (c *Context) Init(softwareName, softwareVersion string) error {
var err error
if err = legacy.MaybeMigrateHome(); err != nil {
@ -102,8 +102,8 @@ func (c *Context) Init() error {
sess, err := engine.NewSession(engine.SessionConfig{
KVStore: kvstore,
Logger: enginex.Logger,
SoftwareName: "ooniprobe-desktop",
SoftwareVersion: version.Version,
SoftwareName: softwareName,
SoftwareVersion: softwareVersion,
AssetsDir: utils.AssetsDir(c.Home),
TempDir: c.TempDir,
})