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

Set defaults for backend creation #469

Merged
merged 2 commits into from
Nov 11, 2021

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Nov 10, 2021

We want to avoid this situation where we have to set the flags to the same value:

fastly backend create --name=example --address=example.com --override-host=example.com --ssl-cert-hostname=example.com --ssl-sni-hostname=example.com

Instead it would better if the user could just set:

fastly backend create --name=example --address=example.com

NOTE: I went back and updated the compute deploy logic so it included ssl-cert-hostname as we were only handling override-host and ssl-sni-hostname.

Examples

  1. Allow empty values
  2. Allow individual values
  3. Ensure sensible defaults
  4. Validate IP address behaviour

1. Allow empty values

If user sets the flags (--override-host, --ssl-cert-hostname, --ssl-sni-hostname) with an empty string, then let those values be used.

$ fastly backend create --name allow_empty --address example.com --override-host "" --ssl-cert-hostname "" --ssl-sni-hostname "" --service-id ... --version latest
$ fastly backend list --service-id ... --version latest --verbose

                Name: allow_empty
                Comment:
                Address: example.com
                Port: 80
                Override host:
                Connect timeout: 1000
                Max connections: 200
                First byte timeout: 15000
                Between bytes timeout: 10000
                Auto loadbalance: false
                Weight: 100
                Healthcheck:
                Shield:
                Use SSL: false
                SSL check cert: false
                SSL CA cert:
                SSL client cert:
                SSL client key:
                SSL cert hostname:
                SSL SNI hostname:
                Min TLS version:
                Max TLS version:
                SSL ciphers:

2. Allow individual values

If user sets the flags (--override-host, --ssl-cert-hostname, --ssl-sni-hostname) with unique values, then let those values be used.

$ fastly backend create --name allow_individual --address example.com --override-host "example-one.com" --ssl-cert-hostname "example-two.com" --ssl-sni-hostname "example-three.com" --service-id ... --version latest
$ fastly backend list --service-id ... --version latest --verbose

                Name: allow_individual
                Comment:
                Address: example.com
                Port: 80
                Override host: example-one.com
                Connect timeout: 1000
                Max connections: 200
                First byte timeout: 15000
                Between bytes timeout: 10000
                Auto loadbalance: false
                Weight: 100
                Healthcheck:
                Shield:
                Use SSL: false
                SSL check cert: false
                SSL CA cert:
                SSL client cert:
                SSL client key:
                SSL cert hostname: example-two.com
                SSL SNI hostname: example-three.com
                Min TLS version:
                Max TLS version:
                SSL ciphers:

3. Ensure sensible defaults

If user omits all three flags (--override-host, --ssl-cert-hostname, --ssl-sni-hostname) and if --address is a hostname, then set all three field values to the hostname given in the --address flag.

$ fastly backend create --name ensure_sensible_defaults --address example.com --service-id ... --version latest
$ fastly backend list --service-id ... --version latest --verbose

                Name: ensure_sensible_defaults
                Comment:
                Address: example.com
                Port: 80
                Override host: example.com
                Connect timeout: 1000
                Max connections: 200
                First byte timeout: 15000
                Between bytes timeout: 10000
                Auto loadbalance: false
                Weight: 100
                Healthcheck:
                Shield:
                Use SSL: false
                SSL check cert: false
                SSL CA cert:
                SSL client cert:
                SSL client key:
                SSL cert hostname: example.com
                SSL SNI hostname: example.com
                Min TLS version:
                Max TLS version:
                SSL ciphers:

4. Validate IP address behaviour

If user omits all three flags (--override-host, --ssl-cert-hostname, --ssl-sni-hostname) and if --address is an IP, then don't set a value for any of the field values.

$ fastly backend create --name validate_ip_address --address 8.8.8.8 --service-id ... --version latest
$ fastly backend list --service-id ... --version latest --verbose

                Name: validate_ip_address_behaviour
                Comment:
                Address: 8.8.8.8
                Port: 80
                Override host:
                Connect timeout: 1000
                Max connections: 200
                First byte timeout: 15000
                Between bytes timeout: 10000
                Auto loadbalance: false
                Weight: 100
                Healthcheck:
                Shield:
                Use SSL: false
                SSL check cert: false
                SSL CA cert:
                SSL client cert:
                SSL client key:
                SSL cert hostname:
                SSL SNI hostname:
                Min TLS version:
                Max TLS version:
                SSL ciphers:

@Integralist Integralist added the bug Something isn't working label Nov 10, 2021
@Integralist Integralist merged commit d418768 into main Nov 11, 2021
@Integralist Integralist deleted the integralist/backend-create-defaults branch November 11, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants