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

Change default hostname #309

Merged
merged 2 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion default_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
# Fill in your authentication
authentication_token = None # example token form: 071cdcce-9241-4965-93af-4a4dbc739135
# Fill in the hostname of the Cloud API
hostname = "localhost"
hostname = "platform.strawberryfields.ai"
# Whether Strawberry Fields should use SSL to connect to the API
use_ssl = true
4 changes: 2 additions & 2 deletions doc/introduction/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and has the following format:
[api]
# Options for the Strawberry Fields cloud API
authentication_token = "071cdcce-9241-4965-93af-4a4dbc739135"
hostname = "localhost"
hostname = "platform.strawberryfields.ai"
use_ssl = true
port = 443

Expand All @@ -44,7 +44,7 @@ Configuration options
environment variable: ``SF_API_AUTHENTICATION_TOKEN``

**hostname (str)** (*optional*)
The hostname of the server to connect to. Defaults to ``localhost``. Must
The hostname of the server to connect to. Defaults to ``platform.strawberryfields.ai``. Must
be one of the allowed hosts. Corresponding environment variable:
``SF_API_HOSTNAME``

Expand Down
6 changes: 3 additions & 3 deletions strawberryfields/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
DEFAULT_CONFIG_SPEC = {
"api": {
"authentication_token": (str, ""),
"hostname": (str, "localhost"),
"hostname": (str, "platform.strawberryfields.ai"),
"use_ssl": (bool, True),
"port": (int, 443),
}
Expand Down Expand Up @@ -102,7 +102,7 @@ def create_config(authentication_token="", **kwargs):
dict[str, dict[str, Union[str, bool, int]]]: the configuration
object
"""
hostname = kwargs.get("hostname", "localhost")
hostname = kwargs.get("hostname", DEFAULT_CONFIG_SPEC["api"]["hostname"][1])
use_ssl = kwargs.get("use_ssl", DEFAULT_CONFIG_SPEC["api"]["use_ssl"][1])
port = kwargs.get("port", DEFAULT_CONFIG_SPEC["api"]["port"][1])

Expand Down Expand Up @@ -263,7 +263,7 @@ def store_account(authentication_token, filename="config.toml", location="user_c

[api]
authentication_token = "MyToken"
hostname = "localhost"
hostname = "platform.strawberryfields.ai"
use_ssl = true
port = 443

Expand Down
8 changes: 4 additions & 4 deletions tests/frontend/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[api]
# Options for the Strawberry Fields Cloud API
authentication_token = "071cdcce-9241-4965-93af-4a4dbc739135"
hostname = "localhost"
hostname = "platform.strawberryfields.ai"
use_ssl = true
port = 443
"""
Expand All @@ -43,7 +43,7 @@
EXPECTED_CONFIG = {
"api": {
"authentication_token": "071cdcce-9241-4965-93af-4a4dbc739135",
"hostname": "localhost",
"hostname": "platform.strawberryfields.ai",
"use_ssl": True,
"port": 443,
}
Expand Down Expand Up @@ -303,7 +303,7 @@ def test_valid_and_invalid_options(self):
def test_only_valid_options(self):
section_config_only_valid = {
"authentication_token": "071cdcce-9241-4965-93af-4a4dbc739135",
"hostname": "localhost",
"hostname": "platform.strawberryfields.ai",
"use_ssl": True,
"port": 443,
}
Expand Down Expand Up @@ -398,7 +398,7 @@ def test_parse_environment_variable_integer(self, monkeypatch):
assert conf.parse_environment_variable("some_integer", "123") == 123


DEFAULT_KWARGS = {"hostname": "localhost", "use_ssl": True, "port": 443}
DEFAULT_KWARGS = {"hostname": "platform.strawberryfields.ai", "use_ssl": True, "port": 443}


class MockSaveConfigToFile:
Expand Down