Skip to content

Commit 3d9be50

Browse files
authored
[client]: deprecate config flag (#4224)
1 parent cb8b6ca commit 3d9be50

File tree

5 files changed

+11
-23
lines changed

5 files changed

+11
-23
lines changed

client/cmd/login.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
func init() {
2727
loginCmd.PersistentFlags().BoolVar(&noBrowser, noBrowserFlag, false, noBrowserDesc)
2828
loginCmd.PersistentFlags().StringVar(&profileName, profileNameFlag, "", profileNameDesc)
29-
loginCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "Netbird config file location")
29+
loginCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "(DEPRECATED) Netbird config file location")
3030
}
3131

3232
var loginCmd = &cobra.Command{
@@ -228,15 +228,10 @@ func doForegroundLogin(ctx context.Context, cmd *cobra.Command, setupKey string,
228228
// update host's static platform and system information
229229
system.UpdateStaticInfo()
230230

231-
var configFilePath string
232-
if configPath != "" {
233-
configFilePath = configPath
234-
} else {
235-
var err error
236-
configFilePath, err = activeProf.FilePath()
237-
if err != nil {
238-
return fmt.Errorf("get active profile file path: %v", err)
239-
}
231+
configFilePath, err := activeProf.FilePath()
232+
if err != nil {
233+
return fmt.Errorf("get active profile file path: %v", err)
234+
240235
}
241236

242237
config, err := profilemanager.ReadConfig(configFilePath)

client/cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ func init() {
126126
rootCmd.PersistentFlags().StringVar(&preSharedKey, preSharedKeyFlag, "", "Sets Wireguard PreSharedKey property. If set, then only peers that have the same key can communicate.")
127127
rootCmd.PersistentFlags().StringVarP(&hostName, "hostname", "n", "", "Sets a custom hostname for the device")
128128
rootCmd.PersistentFlags().BoolVarP(&anonymizeFlag, "anonymize", "A", false, "anonymize IP addresses and non-netbird.io domains in logs and status output")
129+
rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", defaultConfigPath, "(DEPRECATED) Netbird config file location")
129130

130131
rootCmd.AddCommand(upCmd)
131132
rootCmd.AddCommand(downCmd)

client/cmd/service_installer.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ func buildServiceArguments() []string {
3131
args := []string{
3232
"service",
3333
"run",
34-
"--config",
35-
configPath,
3634
"--log-level",
3735
logLevel,
3836
"--daemon-addr",

client/cmd/up.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func init() {
7878

7979
upCmd.PersistentFlags().BoolVar(&noBrowser, noBrowserFlag, false, noBrowserDesc)
8080
upCmd.PersistentFlags().StringVar(&profileName, profileNameFlag, "", profileNameDesc)
81-
upCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "Netbird config file location")
81+
upCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "(DEPRECATED) Netbird config file location")
8282

8383
}
8484

@@ -155,15 +155,9 @@ func runInForegroundMode(ctx context.Context, cmd *cobra.Command, activeProf *pr
155155
return err
156156
}
157157

158-
var configFilePath string
159-
if configPath != "" {
160-
configFilePath = configPath
161-
} else {
162-
var err error
163-
configFilePath, err = activeProf.FilePath()
164-
if err != nil {
165-
return fmt.Errorf("get active profile file path: %v", err)
166-
}
158+
configFilePath, err := activeProf.FilePath()
159+
if err != nil {
160+
return fmt.Errorf("get active profile file path: %v", err)
167161
}
168162

169163
ic, err := setupConfig(customDNSAddressConverted, cmd, configFilePath)

release_files/systemd/[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Wants=network-online.target
77
[Service]
88
Type=simple
99
EnvironmentFile=-/etc/default/netbird
10-
ExecStart=/usr/bin/netbird service run --log-file /var/log/netbird/client-%i.log --config /etc/netbird/%i.json --daemon-addr unix:///var/run/netbird/%i.sock $FLAGS
10+
ExecStart=/usr/bin/netbird service run --log-file /var/log/netbird/client-%i.log --daemon-addr unix:///var/run/netbird/%i.sock $FLAGS
1111
Restart=on-failure
1212
RestartSec=5
1313
TimeoutStopSec=10

0 commit comments

Comments
 (0)