Add runtime language cli argument option
This commit is contained in:
parent
8758ce19ff
commit
fecc1c94b8
3 changed files with 23 additions and 0 deletions
18
cli/setup.go
18
cli/setup.go
|
@ -20,6 +20,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/abcum/surreal/cnf"
|
||||
"github.com/abcum/surreal/log"
|
||||
"github.com/abcum/surreal/util/uuid"
|
||||
)
|
||||
|
@ -104,6 +105,21 @@ func setup() {
|
|||
log.Fatal("Specify a valid PEM encoded private key file.")
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// Lang
|
||||
// --------------------------------------------------
|
||||
|
||||
// Ensure that the default
|
||||
// language options are set
|
||||
|
||||
if opts.DB.Lang == "" {
|
||||
opts.DB.Lang = "lua"
|
||||
}
|
||||
|
||||
if opts.DB.Lang != "js" && opts.DB.Lang != "lua" {
|
||||
log.Fatal("Specify a valid runtime language. Valid languages are js, or lua.")
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// Auth
|
||||
// --------------------------------------------------
|
||||
|
@ -287,4 +303,6 @@ func setup() {
|
|||
|
||||
}
|
||||
|
||||
cnf.Settings = opts
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,8 @@ func init() {
|
|||
startCmd.PersistentFlags().StringVar(&opts.DB.Cert.Key, "db-key", "", "Path to the private key file used to connect to the remote database.")
|
||||
startCmd.PersistentFlags().StringVar(&opts.DB.Path, "db-path", "", flag("db"))
|
||||
|
||||
startCmd.PersistentFlags().StringVarP(&opts.DB.Lang, "language", "l", "lua", "The runtime language to use.")
|
||||
|
||||
startCmd.PersistentFlags().StringVarP(&opts.Cluster.Join, "join", "j", "", flag("join"))
|
||||
|
||||
startCmd.PersistentFlags().StringVarP(&opts.DB.Code, "key", "k", "", flag("key"))
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
package cnf
|
||||
|
||||
var Settings *Options
|
||||
|
||||
// Options defines global configuration options
|
||||
type Options struct {
|
||||
DB struct {
|
||||
|
@ -23,6 +25,7 @@ type Options struct {
|
|||
Host string // Surreal host to connect to
|
||||
Port string // Surreal port to connect to
|
||||
Base string // Base key to use in KV stores
|
||||
Lang string // Base key to use in KV stores
|
||||
Cert struct {
|
||||
CA string
|
||||
Crt string
|
||||
|
|
Loading…
Reference in a new issue