(cmd *Command, conf *proxy.Config, args []string)
| 787 | } |
| 788 | |
| 789 | func parseConfig(cmd *Command, conf *proxy.Config, args []string) error { |
| 790 | // If no instance connection names were provided AND FUSE isn't enabled, |
| 791 | // error. |
| 792 | if len(args) == 0 && conf.FUSEDir == "" { |
| 793 | return newBadCommandError("missing instance_connection_name (e.g., project:region:instance)") |
| 794 | } |
| 795 | |
| 796 | if conf.FUSEDir != "" { |
| 797 | if conf.RunConnectionTest { |
| 798 | return newBadCommandError("cannot run connection tests in FUSE mode") |
| 799 | } |
| 800 | |
| 801 | if err := proxy.SupportsFUSE(); err != nil { |
| 802 | return newBadCommandError( |
| 803 | fmt.Sprintf("--fuse is not supported: %v", err), |
| 804 | ) |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | if len(args) == 0 && conf.FUSEDir == "" && conf.FUSETempDir != "" { |
| 809 | return newBadCommandError("cannot specify --fuse-tmp-dir without --fuse") |
| 810 | } |
| 811 | |
| 812 | if userHasSetLocal(cmd, "address") && userHasSetLocal(cmd, "unix-socket") { |
| 813 | return newBadCommandError("cannot specify --unix-socket and --address together") |
| 814 | } |
| 815 | if userHasSetLocal(cmd, "port") && userHasSetLocal(cmd, "unix-socket") { |
| 816 | return newBadCommandError("cannot specify --unix-socket and --port together") |
| 817 | } |
| 818 | if ip := net.ParseIP(conf.Addr); ip == nil { |
| 819 | return newBadCommandError(fmt.Sprintf("not a valid IP address: %q", conf.Addr)) |
| 820 | } |
| 821 | if userHasSetLocal(cmd, "private-ip") && userHasSetLocal(cmd, "auto-ip") { |
| 822 | return newBadCommandError("cannot specify --private-ip and --auto-ip together") |
| 823 | } |
| 824 | |
| 825 | // If more than one IP type is set, error. |
| 826 | var ipTypes int |
| 827 | if conf.PrivateIP { |
| 828 | ipTypes++ |
| 829 | } |
| 830 | if conf.PSC { |
| 831 | ipTypes++ |
| 832 | } |
| 833 | if conf.SQLDataEnabled { |
| 834 | ipTypes++ |
| 835 | } |
| 836 | if ipTypes > 1 { |
| 837 | return newBadCommandError("cannot specify --private-ip, --psc, and --sql-data flags at the same time") |
| 838 | } |
| 839 | |
| 840 | // If more than one auth method is set, error. |
| 841 | if conf.Token != "" && conf.CredentialsFile != "" { |
| 842 | return newBadCommandError("cannot specify --token and --credentials-file flags at the same time") |
| 843 | } |
| 844 | if conf.Token != "" && conf.GcloudAuth { |
| 845 | return newBadCommandError("cannot specify --token and --gcloud-auth flags at the same time") |
| 846 | } |
no test coverage detected