Commit 11336190 authored by Titouan Soulard's avatar Titouan Soulard

software/rapid-cdn: avoid RegExp to validate hostnames

Using RegExp to validate hostnames is a bad practice, and has a lot of reasons to be wrong.
On top of that, the JSON Schema specification allows, since draft 7, to validate hostnames
against an IDN hostname, by using the `idn-hostname` format.

With these changes, IDN are now supported (.рф and .中國 for instance), and long TLD
should not be a problem anymore.
parent 573c4918
Pipeline #31915 failed with stage
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "http://json-schema.org/draft-07/schema",
"properties": {
"-frontend-quantity": {
"description": "Quantity of Frontends Replicate.",
......@@ -20,7 +20,7 @@
},
"domain": {
"description": "Domain used to generate automatic hostnames for slaves. For example 'example.com' will result with slave hostname 'slaveref.example.com'.",
"pattern": "^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$",
"format": "idn-hostname",
"title": "Domain",
"type": "string"
},
......
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "http://json-schema.org/draft-07/schema",
"properties": {
"custom_domain": {
"description": "Custom Domain to use for the website. Shall contain only letters, numbers and -, and can look like example.com, first2.example.com special-site.example.com.",
"pattern": "^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$",
"format": "idn-hostname",
"title": "Custom Domain",
"type": "string"
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment