private static GitProperties fromResource()

in gremlin-client/src/main/java/software/amazon/utils/GitProperties.java [37:62]


    private static GitProperties fromResource() {
        Properties properties = new Properties();
        try {

            InputStream stream = ClassLoader.getSystemResourceAsStream("git.properties");
            if (stream != null) {
                properties.load(stream);
                stream.close();
            } else {
                // this is where we think the git properties are on AWS Lambda
                File file = new File("/var/task/git.properties");
                if (file.exists()){
                    try (InputStream filestream =  new FileInputStream(file)){
                        properties.load(filestream);
                    };
                }
            }
        } catch (IOException e) {
            // Do nothing
        }
        return new GitProperties(
                properties.getProperty("git.commit.id", "unknown"),
                properties.getProperty("git.build.version", "unknown"),
                properties.getProperty("git.commit.time", "unknown"),
                properties.getProperty("git.build.time", "unknown"));
    }