Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: ipv6 addresses returned instead of ipv4. #1

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ $ curl https://raw.githubusercontent.com/jharshman/fwsync/master/install.sh | sh
## Usage

### Authentication
Communication to the GoogleAPIs requires either setting the environment variable `GOOGLE_APPLICATION_CREDENTIALS` or
alternatively running `gcloud auth application-default login`. If using the `GOOGLE_APPLICATION_CREDENTIALS` environment
variable, it must point to the full path to your downloaded service account json.
The reccomended method of authentication is to run the following command:

For example:

`$ export GOOGLE_APPLICATION_CREDENTIALS=/Users/bob/bobserviceaccount.json`
```bash
$ gcloud auth application-default login
```

### Init
After installing, you can invoke the CLI by typing `fwsync` in your terminal.
Expand Down
4 changes: 2 additions & 2 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func Initialize() *cobra.Command {

_, ok := ask(fmt.Sprintf("You've selected %s, is that correct? [Y/n]: ", firewalls.Items[i].Name), true, func(val string) bool {
switch val {
case "Y", "y", "yes":
case "Y", "y", "yes", "":
case "N", "n", "no":
return false
default:
Expand Down Expand Up @@ -92,7 +92,7 @@ func Initialize() *cobra.Command {
// prompt to nuke existing configuration file.
ask("Existing configuration file detected. Continue anyway? [Y/n]: ", false, func(val string) bool {
switch val {
case "Y", "y", "yes":
case "Y", "y", "yes", "":
case "N", "n", "no":
os.Exit(0)
default:
Expand Down
29 changes: 20 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,33 @@ OS=$(uname -s | tr -d '\n')
ARCH=$(uname -m | tr -d '\n')
RELEASE=https://github.com/jharshman/fwsync/releases/download/${VERSION}/fwsync_${OS}_${ARCH}.tar.gz

which wget > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo "FATAL missing wget"
exit 1
fi

# install
mkdir -p $HOME/.local/bin
wget $RELEASE
wget -q $RELEASE
tar -C $HOME/.local/bin/ --exclude README.md -zxvf fwsync_${OS}_${ARCH}.tar.gz
chmod +x $HOME/.local/bin/fwsync

rcfile="$HOME/.zshrc"
if [[ $SHELL == "/bin/bash" ]]; then
rcfile="$HOME/.bashrc"
fi

# update PATH if required.
if ! grep -q '# ADDED BY FWSYNC' $HOME/.zshrc; then
echo "export PATH=\$HOME/.local/bin:\$PATH # ADDED BY FWSYNC" >> $HOME/.zshrc
if ! grep -q '# ADDED BY FWSYNC' $rcfile; then
echo "export PATH=\$HOME/.local/bin:\$PATH # ADDED BY FWSYNC" >> $rcfile
fi

cat <<EOM
/////////////
// FWSYNC has been installed at $HOME/.local/bin/fwsync
//
// Your PATH has been updated in .zshrc.
// Restart your Terminal for the changes to take effect.
///////////////////////////////////////////////////////////
********************************************************
* FWSYNC has been installed at $HOME/.local/bin/fwsync
*
* Your PATH has been updated in $rcfile
* Restart your Terminal for the changes to take effect.
********************************************************
EOM
2 changes: 1 addition & 1 deletion internal/user/firewall.go
Original file line number Diff lin