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

Clear site aliases #122

Closed
darkons opened this issue Jul 29, 2021 · 5 comments
Closed

Clear site aliases #122

darkons opened this issue Jul 29, 2021 · 5 comments

Comments

@darkons
Copy link

darkons commented Jul 29, 2021

  • Forge SDK Version: 3.8.0
  • Laravel Version: 8.47.0
  • PHP Version: 8.0
  • Database Driver & Version: MySQL 8.0

Description:

When a site has only one alias and update that site with empty aliases array that last alias is not removed.

Steps To Reproduce:

  • Create a site.
  • Add one alias.
  • Update site with empty aliases array.
@tfevens
Copy link
Contributor

tfevens commented Jul 29, 2021

NOTE: This looks like an issue with the API itself, not the SDK. Can replicate the behavior using straight API calls.

Seems that the ability to add/remove aliases from the API is not working.

I can send the following payload:

{
	"aliases" : []
}

which results in a 200 response, but the old aliases are still present:

{
  "site": {
    "id": 1402987,
    "server_id": 329730,
    "name": "test1.com",
    "aliases": [
      "test2.com",
      "test3.com"
    ],
    [...]
  }
}

@tfevens
Copy link
Contributor

tfevens commented Jul 30, 2021

I went back and re-read the documentation, and my original understanding of it was incorrect.

Currently, the API only supports ADDING aliases, not DELETING. Per the documentation:
Use this endpoint to add additional site aliases...

Submitting an empty array of aliases will have no effect, as you're just telling forge "Add nothing to the aliases."

As it stands, this is working as intended. Perhaps we can use this Issue to add the implementation to delete aliases?

@driesvints
Copy link
Member

Feel free to send in a pr, thanks.

@tfevens
Copy link
Contributor

tfevens commented Jul 30, 2021

Feel free to send in a pr, thanks.

We can't send in a PR for a function of the API. It's the API that's not removing the aliases, not just the SDK.

@thetispro
Copy link

You can delete aliases using Update Site: $forge->updateSite($serverId, $siteId, array $data);

See https://forge.laravel.com/api-documentation#update-site

hth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants