public Optional<T> findConfiguration(
      final Map<String, String> environment, final CommandLine.ParseResult parseResult) {
    final CommandLine commandLine = parseResult.commandSpec().commandLine();
    if (isConfigSpecifiedInBothSources(environment, parseResult)) {
      throwExceptionForBothSourcesSpecified(environment, parseResult, commandLine);
    }
    if (parseResult.hasMatchedOption(getConfigOptionName())) {
      return getFromOption(parseResult, commandLine);
    }
    if (environment.containsKey(getConfigEnvName())) {
      return getFromEnvironment(environment, commandLine);
    }
    return Optional.empty();
  }
Finds the configuration resource based on command line options and environment variables.

@param environment the environment variables
@param parseResult the command line parse result
@return an Optional containing the configuration resource, or an empty Optional if no
    configuration resource was found
app/src/main/java/org/hyperledger/besu/cli/util/AbstractConfigurationFinder.java