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

Validate project name in "ddev config" #514

Closed
rfay opened this issue Oct 20, 2017 · 15 comments
Closed

Validate project name in "ddev config" #514

rfay opened this issue Oct 20, 2017 · 15 comments

Comments

@rfay
Copy link
Member

rfay commented Oct 20, 2017

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:

@rickmanelius
Copy link
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.

@andrew-c-tran
Copy link

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‌​]+)*))*$/

@cweagans
Copy link
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?

@rfay
Copy link
Member Author

rfay commented Jan 10, 2018

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

@rfay rfay changed the title Validate sitename in "ddev config" Validate project name in "ddev config" Jan 10, 2018
@cweagans
Copy link
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?

@rickmanelius
Copy link
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.

@rickmanelius rickmanelius added this to the v1.3.0 milestone Jan 23, 2018
@rickmanelius
Copy link
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.

@tmotyl
Copy link
Contributor

tmotyl commented Feb 2, 2018

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."

@rickmanelius
Copy link
Contributor

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

@nearlythere
Copy link
Contributor

nearlythere commented May 2, 2018

Oh, I got snagged by this in a demo today. I was trying to be clever, but not thinking. Thankfully I could run ddev config again and just start over - but it felt like a missed trick that I wasn't warned or told about this.

In this issue, I see a more clever solution is on the roadmap for a 1.x release in the future.

I notice the prompt for docroot is preceded by a sentence explaining what it is.

In the short term, could the Project name possibly have a short sentence explaining the naming convention? Would you accept a PR adding a message about this naming convention?

The project name will also be your hostname. It must be unique and you can only use ASCII letters (a-z), numbers (0-9), or the minus sign (-).
Project name (wordpress):

An example that includes a description.

The docroot is the directory from which your site is served. This is a relative path from your project root (/Users/heathermcnamee/Github/wordpress)
You may leave this value blank if your site files are in the project root
Docroot Location (htdocs):

@dclear dclear modified the milestones: v1.3.0, v1.2.0 May 17, 2018
@budda
Copy link

budda commented Aug 4, 2018

This just tripped me up today as I used a project name with spaces in (being none the wiser from the config questions). Can't believe its still not resolved since last October.

@tmotyl
Copy link
Contributor

tmotyl commented Aug 4, 2018

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.

@rfay
Copy link
Member Author

rfay commented Sep 30, 2018

@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?

@tmotyl
Copy link
Contributor

tmotyl commented Oct 1, 2018

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.

@rfay
Copy link
Member Author

rfay commented Oct 1, 2018

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

rfay added a commit to rfay/ddev that referenced this issue Oct 6, 2018
rfay added a commit to rfay/ddev that referenced this issue Oct 6, 2018
rfay added a commit to rfay/ddev that referenced this issue Oct 9, 2018
@rfay rfay closed this as completed in bdfd80d Oct 10, 2018
@dclear dclear modified the milestones: v1.6.0, v1.3.0 Oct 13, 2018
joshsedl added a commit to webksde/ddev-vscode-devcontainer-drupal-template that referenced this issue Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants