Skip to content

Commit

Permalink
improve: add auto version number. (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: xhaopan <[email protected]>
  • Loading branch information
suninsky and suninsky authored Jan 5, 2023
1 parent 7461946 commit 08cf862
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,32 @@
import org.apache.hadoop.fs.cosn.Constants;
import org.apache.hadoop.fs.cosn.Unit;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
* This class contains constants for configuration keys used in the cos file system.
*/
@InterfaceAudience.Private
@InterfaceStability.Unstable
public class CosNConfigKeys extends CommonConfigurationKeys {
public static final String USER_AGENT = "fs.cosn.user.agent";
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v8.2.0";

private static String version;

static {
String path = "META-INF/maven/com.qcloud.cos/hadoop-cos/pom.properties";
Properties properties = new Properties();
try (InputStream in = CosNConfigKeys.class.getClassLoader().getResourceAsStream(path)) {
properties.load(in);
version = properties.getProperty("version");
} catch (IOException e) {
version = "unknown";
}
}

public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v" + version;

public static final String TENCENT_EMR_VERSION_KEY = "fs.emr.version";

Expand Down

0 comments on commit 08cf862

Please sign in to comment.