goodrobots / maverick-api

API backend for maverick-web
MIT License
8 stars 5 forks source link

Bind to ssl and non-ssl ports simultaneously #227

Closed fnoop closed 4 years ago

fnoop commented 4 years ago

If ssl cert/key defined, also bind to ssl port. But always bind to non-ssl port.

-web will determine which port to connect to depending on if using http or https.

fnoop commented 4 years ago

@SamuelDudley I've had a quick go at adapting -api to bind to both ssl and non-ssl. It binds to non-ssl by default, and if ssl params available then binds to ssl as well. Similarly it adds ssl info to the zeroconf broadcast if available. Could you have a look and see if what I've done makes sense OK?

I've renamed server_port to server_port_nonssl, mainly for clarity and also so previous configs don't get picked up as the default port has changed.

Apr 04 10:55:47 maverick-ubuntuvm api.sh[4255]:     zeroconf service: ServiceInfo(type='_api._tcp.local.', name='maverick-api (maverick-ubuntuvm:System)._api._tcp.local.', addresses=[b'\x00\x00\x00\x00'], port=6003, weight=0, priority=0, server='maverick-api (maverick-ubuntuvm:System)._api._tcp.local.', properties={'httpEndpoint': 'http://maverick-ubuntuvm.local:6003/graphql', 'wsEndpoint': 'ws://maverick-ubuntuvm.local:6003/subscriptions', 'schemaEndpoint': '//maverick-ubuntuvm.local:6003/schema', 'websocketsOnly': False, 'uuid': '881922ae-d056-50f6-8ac9-6bf84ddc75ca', 'service_type': 'maverick-api', 'name': 'maverick-ubuntuvm:System', 'httpsEndpoint': ('https://maverick-ubuntuvm.local:6004/graphql',), 'wssEndpoint': ('wss://maverick-ubuntuvm.local:6004/subscriptions',)})
SamuelDudley commented 4 years ago

Looks great! Thanks for doing this.