Skip to content
Snippets Groups Projects
Commit 344d27eb authored by Erik Hedenström's avatar Erik Hedenström
Browse files

Initial setup

parents
Branches
Tags
No related merge requests found
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
main
udm-query
LICENSE 0 → 100644
The MIT License (MIT)
Copyright © 2022 Erik Hedenström
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# Vault Environment Tool
A small utility to export data from vault as environment variables or download as files.
## Installation
You can download one of the pre-compiled binaries from the list below.
- [Mac](http://s3.hedenstroem.com/utils/udm-query/udm-query-darwin)
- [Linux (ARM)](http://s3.hedenstroem.com/utils/udm-query/udm-query-linux-arm)
- [Linux (32-bit)](http://s3.hedenstroem.com/utils/udm-query/udm-query-linux-i386)
- [Linux (64-bit)](http://s3.hedenstroem.com/utils/udm-query/udm-query-linux-amd64)
- [Windows (32-bit)](http://s3.hedenstroem.com/utils/udm-query/udm-query-windows.exe)
- [Windows (64-bit)](http://s3.hedenstroem.com/utils/udm-query/udm-query-windows-x64.exe)
## Usage
```bash
> udm-query help
```
package cmd
import (
"fmt"
"os"
"github.com/joho/godotenv"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var RootCmd = &cobra.Command{
Use: "vaultenv",
Short: "Root Short",
Long: `Root Long`,
}
func Execute() {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(-1)
}
}
func init() {
cobra.OnInitialize(initEnv)
RootCmd.PersistentFlags().StringP("host", "h", "192.168.1.1", "Address to the USM SSH server")
RootCmd.PersistentFlags().StringP("password", "p", "", "SSH password")
viper.SetEnvPrefix("SSH")
viper.BindPFlag("HOST", RootCmd.PersistentFlags().Lookup("host"))
viper.BindPFlag("PASSWORD", RootCmd.PersistentFlags().Lookup("password"))
}
func initEnv() {
_ = godotenv.Load(".env")
viper.AutomaticEnv()
}
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"gitlab.hedenstroem.com/go/udm-query/constant"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "version Short",
Long: `version Long`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version: %s", constant.Version)
},
}
func init() {
RootCmd.AddCommand(versionCmd)
}
//go:generate sh -c "sed -i \"s/const Version = \\\".*\\\"/const Version = \\\"`git describe --tags --long --always`\\\"/\" version.go"
package constant
// Version git version number
const Version = "0.0.0"
go.mod 0 → 100644
module gitlab.hedenstroem.com/go/udm-query
go 1.17
require (
github.com/joho/godotenv v1.4.0
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
)
require (
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
go.sum 0 → 100644
This diff is collapsed.
main.go 0 → 100644
// Copyright © 2022 Erik Hedenström <erik@hedenstroem.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package main
import "gitlab.hedenstroem.com/go/udm-query/cmd"
func main() {
cmd.Execute()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment