mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
set all settings initially using config.
This commit is contained in:
parent
cf4e0666fe
commit
0760976b4b
@ -10,6 +10,8 @@ import (
|
|||||||
type Session struct {
|
type Session struct {
|
||||||
File string
|
File string
|
||||||
|
|
||||||
|
PrivateMode bool
|
||||||
|
LockedControls bool
|
||||||
ImplicitHosting bool
|
ImplicitHosting bool
|
||||||
InactiveCursors bool
|
InactiveCursors bool
|
||||||
MercifulReconnect bool
|
MercifulReconnect bool
|
||||||
@ -27,6 +29,16 @@ func (Session) Init(cmd *cobra.Command) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().Bool("session.private_mode", false, "whether private mode should be enabled initially")
|
||||||
|
if err := viper.BindPFlag("session.private_mode", cmd.PersistentFlags().Lookup("session.private_mode")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().Bool("session.locked_controls", false, "whether controls should be locked for users initially")
|
||||||
|
if err := viper.BindPFlag("session.locked_controls", cmd.PersistentFlags().Lookup("session.locked_controls")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().Bool("session.implicit_hosting", true, "allow implicit control switching")
|
cmd.PersistentFlags().Bool("session.implicit_hosting", true, "allow implicit control switching")
|
||||||
if err := viper.BindPFlag("session.implicit_hosting", cmd.PersistentFlags().Lookup("session.implicit_hosting")); err != nil {
|
if err := viper.BindPFlag("session.implicit_hosting", cmd.PersistentFlags().Lookup("session.implicit_hosting")); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -74,6 +86,8 @@ func (Session) Init(cmd *cobra.Command) error {
|
|||||||
func (s *Session) Set() {
|
func (s *Session) Set() {
|
||||||
s.File = viper.GetString("session.file")
|
s.File = viper.GetString("session.file")
|
||||||
|
|
||||||
|
s.PrivateMode = viper.GetBool("session.private_mode")
|
||||||
|
s.LockedControls = viper.GetBool("session.locked_controls")
|
||||||
s.ImplicitHosting = viper.GetBool("session.implicit_hosting")
|
s.ImplicitHosting = viper.GetBool("session.implicit_hosting")
|
||||||
s.InactiveCursors = viper.GetBool("session.inactive_cursors")
|
s.InactiveCursors = viper.GetBool("session.inactive_cursors")
|
||||||
s.MercifulReconnect = viper.GetBool("session.merciful_reconnect")
|
s.MercifulReconnect = viper.GetBool("session.merciful_reconnect")
|
||||||
|
@ -19,8 +19,8 @@ func New(config *config.Session) *SessionManagerCtx {
|
|||||||
logger: log.With().Str("module", "session").Logger(),
|
logger: log.With().Str("module", "session").Logger(),
|
||||||
config: config,
|
config: config,
|
||||||
settings: types.Settings{
|
settings: types.Settings{
|
||||||
PrivateMode: false, // By default disabled.
|
PrivateMode: config.PrivateMode,
|
||||||
LockedControls: false, // By default disabled.
|
LockedControls: config.LockedControls,
|
||||||
ImplicitHosting: config.ImplicitHosting,
|
ImplicitHosting: config.ImplicitHosting,
|
||||||
InactiveCursors: config.InactiveCursors,
|
InactiveCursors: config.InactiveCursors,
|
||||||
MercifulReconnect: config.MercifulReconnect,
|
MercifulReconnect: config.MercifulReconnect,
|
||||||
|
Loading…
Reference in New Issue
Block a user