Added hal prefix to all config properties
This commit is contained in:
parent
4dfa80c17f
commit
203bb67f7f
12 changed files with 123 additions and 62 deletions
|
|
@ -43,8 +43,8 @@ public class SmartHomeDaemon implements HalDaemon {
|
|||
public static final String ENDPOINT_TOKEN = "api/assistant/google/auth/token";
|
||||
public static final String ENDPOINT_SMARTHOME = "api/assistant/google/smarthome";
|
||||
|
||||
private static final String PARAM_PORT = "assistant.google.port";
|
||||
private static final String PARAM_CLIENT_ID = "assistant.google.client_id";
|
||||
private static final String CONFIG_PORT = "hal_assistant.google.port";
|
||||
private static final String CONFIG_CLIENT_ID = "hal_assistant.google.client_id";
|
||||
|
||||
private SmartHomeImpl smartHome;
|
||||
private OAuth2Registry oAuth2Registry;
|
||||
|
|
@ -53,8 +53,8 @@ public class SmartHomeDaemon implements HalDaemon {
|
|||
@Override
|
||||
public void initiate(ScheduledExecutorService executor) {
|
||||
if (smartHome == null) {
|
||||
if (!HalContext.containsProperty(PARAM_PORT) ||
|
||||
!HalContext.containsProperty(PARAM_CLIENT_ID)) {
|
||||
if (!HalContext.containsProperty(CONFIG_PORT) ||
|
||||
!HalContext.containsProperty(CONFIG_CLIENT_ID)) {
|
||||
logger.severe("Missing configuration, abort initializations.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -62,10 +62,10 @@ public class SmartHomeDaemon implements HalDaemon {
|
|||
smartHome = new SmartHomeImpl();
|
||||
|
||||
oAuth2Registry = new OAuth2Registry();
|
||||
oAuth2Registry.addWhitelist(HalContext.getStringProperty(PARAM_CLIENT_ID));
|
||||
oAuth2Registry.addWhitelist(HalContext.getStringProperty(CONFIG_CLIENT_ID));
|
||||
oAuth2Registry.setTokenListener(smartHome);
|
||||
|
||||
httpServer = new HttpServer(HalContext.getIntegerProperty(PARAM_PORT));
|
||||
httpServer = new HttpServer(HalContext.getIntegerProperty(CONFIG_PORT));
|
||||
httpServer.setPage(ENDPOINT_AUTH, new OAuth2AuthorizationPage(oAuth2Registry));
|
||||
httpServer.setPage(ENDPOINT_TOKEN, new OAuth2TokenPage(oAuth2Registry));
|
||||
httpServer.setPage(ENDPOINT_SMARTHOME, new SmartHomePage(smartHome));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue