fleet/orbit/pkg/update/options_windows.go
Tomas Touceda 989e638cc0
Make creating dirs and files more secure by checking permissions (#1566)
* Add safe mkdirall and open

* Use secure as much as possible and merge gomodules for orbit to fleet

* Improve openfile and mkdirall to check for permissiveness instead of equality

* Don't shift

* Fix links

* Address review comments
2021-08-11 11:02:22 -03:00

31 lines
784 B
Go

package update
import (
"os"
"path/filepath"
"github.com/fleetdm/fleet/v4/orbit/pkg/constant"
"github.com/theupdateframework/go-tuf/client"
)
var (
// DefaultOptions are the default options to use when creating an update
// client.
DefaultOptions = Options{
RootDirectory: `C:\Program Files\Orbit`,
ServerURL: defaultURL,
RootKeys: defaultRootKeys,
LocalStore: client.MemoryLocalStore(),
InsecureTransport: false,
Platform: constant.PlatformName,
OrbitChannel: "stable",
OsquerydChannel: "stable",
}
)
func init() {
// Set root directory to value of ProgramFiles environment variable if not set
if dir := os.Getenv("ProgramFiles"); dir != "" {
DefaultOptions.RootDirectory = filepath.Join(dir, "Orbit")
}
}