|
|
@@ -3,8 +3,11 @@ package cn.seecoder.seecoderportalserver.service;
|
|
|
import com.nju.edu.gitlab.SeecoderGitlabClient;
|
|
|
import com.nju.edu.gitlab.SeecoderGitlabException;
|
|
|
import com.nju.edu.gitlab.vo.GitlabUserVO;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
|
|
|
/**
|
|
|
* @author kunduin
|
|
|
@@ -12,10 +15,19 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class GitlabService {
|
|
|
|
|
|
- private final SeecoderGitlabClient client;
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(GitlabService.class);
|
|
|
+ @Value("${seec.gitlab.url}")
|
|
|
+ private String url;
|
|
|
+ @Value("${seec.gitlab.host}")
|
|
|
+ private String host;
|
|
|
+ @Value("${seec.gitlab.token}")
|
|
|
+ String token;
|
|
|
+ private SeecoderGitlabClient client;
|
|
|
|
|
|
- public GitlabService(@Value("${seec.gitlab.url}") String url, @Value("${seec.gitlab.token}") String token) {
|
|
|
- this.client = new SeecoderGitlabClient(url, token);
|
|
|
+ @PostConstruct
|
|
|
+ public void initClient() {
|
|
|
+ log.info(String.format("GitlabService initClient host: %s, token: %s", host, token));
|
|
|
+ client = new SeecoderGitlabClient(host, token);
|
|
|
}
|
|
|
|
|
|
public GitlabUserVO createGitlabUser(int userId, String username, String password, String email) throws SeecoderGitlabException {
|