39 lines
944 B
Java
39 lines
944 B
Java
package org.gcube.data.access.fs;
|
|
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.InputStream;
|
|
import java.util.Properties;
|
|
|
|
import org.gcube.common.security.providers.SecretManagerProvider;
|
|
import org.gcube.common.security.secrets.GCubeSecret;
|
|
|
|
public class Initializer {
|
|
|
|
private static final String propFile = "/Users/lucio/Documents/tokens.properties";
|
|
|
|
private static final String devEnv = "dev-devvre";
|
|
private static final String devRoot = "dev-root";
|
|
|
|
|
|
public static void setUp(String env){
|
|
|
|
try(InputStream is = new FileInputStream(new File(propFile))){
|
|
Properties prop = new Properties();
|
|
prop.load(is);
|
|
String value =(String)prop.get(env);
|
|
String[] splitValue = value.split(",");
|
|
String token = splitValue[1];
|
|
SecretManagerProvider.instance.set(new GCubeSecret(token));
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
}
|
|
|
|
public static void setUp(){
|
|
setUp(devRoot);
|
|
}
|
|
}
|