public static GitHubBuilder fromPropertyFile() throws IOException { File homeDir = new File(System.getProperty("user.home")); File propertyFile = new File(homeDir, ".github"); return fromPropertyFile(propertyFile.getPath()); }
public static GitHubBuilder fromPropertyFile() throws IOException { File homeDir = new File(System.getProperty("user.home")); File propertyFile = new File(homeDir, ".github"); return fromPropertyFile(propertyFile.getPath()); }
public static GitHubBuilder fromPropertyFile() throws IOException { File homeDir = new File(System.getProperty("user.home")); File propertyFile = new File(homeDir, ".github"); return fromPropertyFile(propertyFile.getPath()); }
/** * First check if the credentials are configured using the ~/.github properties file. * * If no user is specified it means there is no configuration present so check the environment instead. * * If there is still no user it means there are no credentials defined and throw an IOException. * * @return the configured Builder from credentials defined on the system or in the environment. * * @throws IOException If there are no credentials defined in the ~/.github properties file or the process environment. */ public static GitHubBuilder fromCredentials() throws IOException { Exception cause = null; GitHubBuilder builder; try { builder = fromPropertyFile(); if (builder.oauthToken != null || builder.user != null) return builder; } catch (FileNotFoundException e) { // fall through cause = e; } builder = fromEnvironment(); if (builder.oauthToken != null || builder.user != null) return builder; else throw (IOException)new IOException("Failed to resolve credentials from ~/.github or the environment.").initCause(cause); }
/** * First check if the credentials are configured using the ~/.github properties file. * * If no user is specified it means there is no configuration present so check the environment instead. * * If there is still no user it means there are no credentials defined and throw an IOException. * * @return the configured Builder from credentials defined on the system or in the environment. * * @throws IOException If there are no credentials defined in the ~/.github properties file or the process environment. */ public static GitHubBuilder fromCredentials() throws IOException { Exception cause = null; GitHubBuilder builder; try { builder = fromPropertyFile(); if (builder.oauthToken != null || builder.user != null) return builder; } catch (FileNotFoundException e) { // fall through cause = e; } builder = fromEnvironment(); if (builder.oauthToken != null || builder.user != null) return builder; else throw (IOException)new IOException("Failed to resolve credentials from ~/.github or the environment.").initCause(cause); }
/** * First check if the credentials are configured using the ~/.github properties file. * * If no user is specified it means there is no configuration present so check the environment instead. * * If there is still no user it means there are no credentials defined and throw an IOException. * * @return the configured Builder from credentials defined on the system or in the environment. * * @throws IOException If there are no credentials defined in the ~/.github properties file or the process environment. */ public static GitHubBuilder fromCredentials() throws IOException { Exception cause = null; GitHubBuilder builder; try { builder = fromPropertyFile(); if (builder.user != null) return builder; } catch (FileNotFoundException e) { // fall through cause = e; } builder = fromEnvironment(); if (builder.user != null) return builder; else throw (IOException)new IOException("Failed to resolve credentials from ~/.github or the environment.").initCause(cause); }