Sort API keys alphabetically

Currently the order of API keys seems to be non-deterministic:
d46caa184e/app/dao/api_key_dao.py (L32-L39)

Generally we sort things alphabetically, unless there’s a good reason to
do otherwise.

This commit sorts the API keys alphabetically.
This commit is contained in:
Chris Hill-Scott
2018-11-07 12:05:11 +00:00
parent 591bbe9a49
commit 2639e2c46f
2 changed files with 12 additions and 14 deletions

View File

@@ -340,7 +340,10 @@ class Service():
@cached_property
def api_keys(self):
return api_key_api_client.get_api_keys(self.id)['apiKeys']
return sorted(
api_key_api_client.get_api_keys(self.id)['apiKeys'],
key=lambda key: key['name'].lower(),
)
@property
def api_key_names(self):