Skip to content

Commit

Permalink
Merge branch 'release/3.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmurray committed May 3, 2021
2 parents 7e477f0 + 4cf7538 commit 41f1fda
Show file tree
Hide file tree
Showing 7 changed files with 933 additions and 185 deletions.
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,51 @@ It'll regularly check your IP address and update a selected Digital Ocean domain
- At least one domain name added to your account.
- At least a `cname` or an `A` record added to a domain that DODDNS will try to update.

# Docs
## Installation / Usage

You can see installation instruction, usage and other things [in the documentation](https://atomescrochus.gitbook.io/doddns/).
Using composer, you will need to run the following command to install DODDNS into the global space:

```
composer global require jpmurray/doddns
```

For DODDNS to work correctly you will have to make sure composer vendor's bin folder is added to your system's `$PATH`. You can test it by typing `doddns` in your terminal of choice: if it is installed correctly, you should be seeing commands usage instructions.

Next, you will have to add your DigitalOcean API token with the `token:add` command and then select which record you want to update with the `record:select` command.

Once it's done, you're good to go!

## Available commands

You can then use the doddns command to see a list of possible actions:

- `ip:last`: will output the last known IP that has been found / used and the timestamp of last update.
- `ip:current`: will query ipcheck.doddns.com to get your current IP address.
- `notifications:toggle`: turn desktop notification on or off (default is off).
- `record:delete`: removes saved record from the config file.
- `record:select`: Display a list of domains and records found with your DigitalOcean token to choose which to update with your current IP address.
- `record:update`: updates the selected record in config file with current IP.
- `token:add {token}`: will set your DigitalOcean personal access token, overwriting any existing value.

### Automatic updates

If you want DODDNS to update your selected domain record automatically with your current IP address, you will have to add entry to your cron tab like so:

```
* * * * * php /path-to-doddns/doddns schedule:run >> /dev/null 2>&1.
```

After that, DODDNS will try to update every hours by itself.

## Updating DODDNS

### Version 3.0.0 and after

Version 3.0.0 changed a lot in term of workflow. If you install DODDNS from before 3.0.0, it is suggested that you remove the doddns folder entirely from the .config folder located in your home directory then start back from scratch so everything is clean.

### Before 3.0.0

If you've pulled or downloaded a new version, be sure to run doddns setup and choose the upgrade option to make sure your local database is up to date! You can also forgo the menu to upgrade directly using `doddns setup -U`.

## PRs
Any help is appreciated, please PR to the develop branch.
17 changes: 6 additions & 11 deletions app/Helpers/DigitalOceanHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,24 @@

namespace App\Helpers;

use DigitalOceanV2\Adapter\GuzzleHttpAdapter;
use DigitalOceanV2\DigitalOceanV2;
use DigitalOceanV2\Client;

/**
*
*/
class DigitalOceanHelper
{

private $adapter;
private $digitalocean;

public $domain;
public $domainRecord;

protected $token;

public function __construct($token)
{
$this->token = $token;

$this->adapter = new GuzzleHttpAdapter($this->token);
$this->digitalocean = new DigitalOceanV2($this->adapter);
$this->digitalocean = new Client();
$this->digitalocean->authenticate($this->token);
$this->domain = $this->digitalocean->domain();
$this->domainRecord = $this->digitalocean->domainRecord();

Expand All @@ -41,7 +36,7 @@ public function getDomains()
public function getDomainRecords($domain)
{
return collect($this->domainRecord->getAll($domain))->filter(function ($record) {
return $record->type == "CNAME" || $record->type == "A";
return $record->type == 'CNAME' || $record->type == 'A';
});
}
}
Binary file modified builds/doddns
Binary file not shown.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## X (Next release)

## 3.5.0

- Usage of the Digital Ocean API Client has changed, fixed its usage.

## 3.4.2

- Box file was empty, didn't compile binary correctly.
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
],
"require": {
"php": "^7.3",
"guzzlehttp/guzzle": "^7.0",
"guzzlehttp/guzzle": "^7.2",
"laravel-zero/framework": "^8.0",
"nunomaduro/laravel-console-menu": "^3.1",
"nunomaduro/laravel-desktop-notifier": "^2.2",
"toin0u/digitalocean-v2": "~2.0",
"toin0u/digitalocean-v2": "~4.3",
"http-interop/http-factory-guzzle": "^1.0",
"laminas/laminas-text": "^2.7"
},
"require-dev": {
Expand Down
Loading

0 comments on commit 41f1fda

Please sign in to comment.