Skip to content

Validate project name in "ddev config" #514

Closed

Description

@rfay

What happened (or feature request):

Edit:
The project name in ddev config must be a valid hostname, so a valid URL can be constructed.

If you enter a "project name" in ddev config which has spaces for example, it won't complain, but when you do a ddev start

Failed to start: nope not here.ddev.local is not a valid hostname. Please enter a site name in your configuration that will allow for a valid hostname. See https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames for valid hostname requirements

So we're validating on start, but we need to validate at config.

What you expected to happen:

How to reproduce this:

Version: Please include the output of ddev version, docker version and the project's .ddev/config.yaml.

Anything else do we need to know:

Related source links or issues:

Activity

  1. rickmanelius commented on Dec 12, 2017

    @rickmanelius
    Contributor

    Updating to reflect that I believe this is 100% actionable with no additional AC defined, but if @cweagans doesn't believe that to be the case we should kick back with an incubate label and get this more fleshed out.

  2. andrew-c-tran commented on Jan 10, 2018

    @andrew-c-tran

    The UI is currently using RFC 2396 Section 3.2.2 rules to validate project names.

    Standard can be found:
    https://tools.ietf.org/html/rfc2396

    Regex in use is:
    /^([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)+(\.([a-zA-Z0-9]+(-[a-zA-Z0-9‌​]+)*))*$/

  3. cweagans commented on Jan 10, 2018

    @cweagans
    Contributor

    I was looking at this again. Go has a built in way to validate URLs, but we also agreed that we were standardizing on "project" instead of "site". I'm assuming that's still the case, so what would you like to do here? Leave the messaging the same and just validate that whatever we get is a valid hostname?

  4. rfay commented on Jan 10, 2018

    @rfay
    MemberAuthor

    I edited the OP, let me know if that's clear enough @cweagans

  5. changed the title [-]Validate sitename in "ddev config"[/-] [+]Validate project name in "ddev config"[/+] on Jan 10, 2018
  6. cweagans commented on Jan 10, 2018

    @cweagans
    Contributor

    @rfay I'm sorry, I'm not being clear.

    If we're using project name instead of site name, it's not obvious that this input is going to be validated like a URL. As a user, how am I supposed to know what to enter here the first time? Yeah, the error message will correct me, but how can we make this clear the first time a user is going through this process?

  7. rickmanelius commented on Jan 10, 2018

    @rickmanelius
    Contributor

    Thanks, @rfay, for the clarification. I'm tracking and onboard. Basically, whatever is submitted as a project name + the additional .ddev.local (or whatever if we ultimately change that as per #416 should validate. Ideally the validation from the Go library matches what @andrew-c-tran is using on the front-end.

    As for expectation setting, it sounds like we're wanting to provide helper text to the end-user so that they know what is acceptable and why. There are two approaches. We could add an additional sentence before or after validation fails OR we could simply strip out invalid characters and suggest that along with text explaining why. I don't have a specific recommendation of verbiage, but wanted to confirm if that is the issue that @cweagans is surfacing.

  8. added this to the v1.3.0 milestone on Jan 23, 2018
  9. rickmanelius commented on Jan 23, 2018

    @rickmanelius
    Contributor

    Updated the milestone to reflect when this might be appropriate to address. Of course, if we're blocked on upcoming runway, this can be cherry-picked and completed ahead of that.

  10. tmotyl commented on Feb 2, 2018

    @tmotyl
    Contributor

    I've just stumbled upon this one too. The term "project name" is confusing.
    Also documentation like http://ddev.readthedocs.io/en/latest/users/cli-usage/#typo3-quickstart is not specific enough "ddev config will prompt you for a project name, docroot, and project type."

  11. rickmanelius commented on Feb 5, 2018

    @rickmanelius
    Contributor

    Related is our standardization around standardizing around "project" over "app" and "site" #526

  12. 4 remaining items

  13. tmotyl commented on Aug 4, 2018

    @tmotyl
    Contributor

    another thing which is related and hit us few times already, is the uppercase project name like "Myproject".
    This gave us headaches because in some places ddev used uppercase name and in some cases it lowercased the name.

  14. added a commit that references this issue on Sep 30, 2018
    3800f26
  15. rfay commented on Sep 30, 2018

    @rfay
    MemberAuthor

    @tmotyl I have a PR up for this in #1147, but it doesn't deal with your upper/lower question, as upper and lower case should be valid in hostnames and thus projectnames. Could you give an example of a problematic usage?

  16. tmotyl commented on Oct 1, 2018

    @tmotyl
    Contributor

    Randy, I dont have an exaple at hand unfortunatelly. I remember we have troubles with this some months ago. If i remember correctly in some places in yaml the upprecsse name was used.

  17. rfay commented on Oct 1, 2018

    @rfay
    MemberAuthor

    Thanks. I'll be looking for that. I don't think it's directly related to this one, but will keep my eyes open.

  18. added 3 commits that reference this issue on Oct 6, 2018
    be48e35
    95ba2fd
    f338b94
  19. modified the milestones: v1.6.0, v1.3.0 on Oct 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions