From b2200fb6cc465d8d48c3b791bfa34408faa0373a Mon Sep 17 00:00:00 2001 From: esoe Date: Fri, 25 Oct 2024 16:34:50 +0300 Subject: [PATCH] qq --- face/logs/teh.log | 12 +- face/logs/teh.log.2024-10-16.0.gz | Bin 5109 -> 0 bytes face/logs/teh.log.2024-10-17.0.gz | Bin 1528 -> 0 bytes face/logs/teh.log.2024-10-23.0.gz | Bin 0 -> 667 bytes face/logs/teh.log.2024-10-24.0.gz | Bin 0 -> 950 bytes .../face/config/FaceProperties.java | 58 +++++++ .../face/config/SourceProperties.java | 59 +++++++ .../face/config/StorageProperties.java | 58 +++++++ .../controllers/api/v1/ApiController.java | 6 + .../face/v1/MainframeController.java | 40 ++++- .../technologies/face/services/LinksFace.java | 7 - .../face/services/LinksService.java | 149 ------------------ .../face/services/PropertyService.java | 39 +++++ face/src/main/resources/application-face.yaml | 20 +-- .../main/resources/application-source.yaml | 27 ++-- .../main/resources/application-storage.yaml | 41 ++--- 16 files changed, 309 insertions(+), 207 deletions(-) delete mode 100644 face/logs/teh.log.2024-10-16.0.gz delete mode 100644 face/logs/teh.log.2024-10-17.0.gz create mode 100644 face/logs/teh.log.2024-10-23.0.gz create mode 100644 face/logs/teh.log.2024-10-24.0.gz create mode 100644 face/src/main/java/gsp/technologies/face/config/FaceProperties.java create mode 100644 face/src/main/java/gsp/technologies/face/config/SourceProperties.java create mode 100644 face/src/main/java/gsp/technologies/face/config/StorageProperties.java delete mode 100644 face/src/main/java/gsp/technologies/face/services/LinksFace.java delete mode 100644 face/src/main/java/gsp/technologies/face/services/LinksService.java create mode 100644 face/src/main/java/gsp/technologies/face/services/PropertyService.java diff --git a/face/logs/teh.log b/face/logs/teh.log index b10f4d2..a82b102 100644 --- a/face/logs/teh.log +++ b/face/logs/teh.log @@ -1,3 +1,9 @@ -{"@timestamp":"2024-10-23T06:23:27.800975600Z","log.level":"INFO","process.pid":18696,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 18696 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} -{"@timestamp":"2024-10-23T06:23:27.814171300Z","log.level":"INFO","process.pid":18696,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"The following 3 profiles are active: \"face\", \"source\", \"storage\"","ecs.version":"8.11"} -{"@timestamp":"2024-10-23T06:23:29.758343700Z","log.level":"INFO","process.pid":18696,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.446 seconds (process running for 3.608)","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T05:51:49.542925200Z","log.level":"INFO","process.pid":9536,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 9536 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T05:51:49.558489700Z","log.level":"INFO","process.pid":9536,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"The following 3 profiles are active: \"face\", \"source\", \"storage\"","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T05:51:51.532321800Z","log.level":"INFO","process.pid":9536,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.486 seconds (process running for 3.684)","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T05:55:37.500402200Z","log.level":"INFO","process.pid":21840,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 21840 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T05:55:37.507405500Z","log.level":"INFO","process.pid":21840,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"The following 3 profiles are active: \"face\", \"source\", \"storage\"","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T05:55:39.368250700Z","log.level":"INFO","process.pid":21840,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.348 seconds (process running for 3.422)","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T06:00:05.447276500Z","log.level":"INFO","process.pid":2192,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Starting FaceApplicationTests using Java 17.0.7 with PID 2192 (started by devuser in C:\\Users\\devuser\\Documents\\code\\teh\\face)","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T06:00:05.454276700Z","log.level":"INFO","process.pid":2192,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"The following 3 profiles are active: \"face\", \"source\", \"storage\"","ecs.version":"8.11"} +{"@timestamp":"2024-10-25T06:00:07.297329800Z","log.level":"INFO","process.pid":2192,"process.thread.name":"main","service.name":"face","service.version":"1","service.environment":"Production","service.node.name":"Primary","log.logger":"gsp.technologies.face.FaceApplicationTests","message":"Started FaceApplicationTests in 2.326 seconds (process running for 3.392)","ecs.version":"8.11"} diff --git a/face/logs/teh.log.2024-10-16.0.gz b/face/logs/teh.log.2024-10-16.0.gz deleted file mode 100644 index 5966bcf4d5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oM%$1ncQoZo2^TAqSEF>K=gv7}1!) zMJ4k^%a!)@#srO+B7dj2OETAtOS}0i_FbF_8bg^1w<;i!U_B+v1W+Xdlob7k{S@K| zaPrE<>X?U;myl%&u{BmD>ulh5kReSdGTZpd-a|&#sH$X-1f8*g`%+ku1S={T5upEy e82HV|A_*)jnO}Ufb#(t;A^QhY3p3HAUjP6-j_QnV6T9}|`QPcL;yLM~Z4rcDWtM^qGmz^Ew>eHEb-fp#jJ|^te zYvUoj4m;eLYSTIhSrc&lZ+rtkUw6C4RyrQ}0M!Vv6RHyQI-YjlY2Vp)jow>{_90Gv z*S$tmVuB@lvfT#V-Cm>DYM_e{_nR91enz$F_mD8ME&5iJc0i%g>OJslr)#6s9!!^XX*-K`N-E`~wqw*ch~OP2-*-D~{lHE8CcWv^PjY z9=$10`FfEuxr9-0dw&{t&ciWfG8sXRWvaN~@&hBdKZxL64S^gO79vBzRIaT9x;R`O z`F-0)W-I3r#~D#mgrERH!6=qASAvd0AeCGuf=NCWt1+LCo$xUsB_Hc!OC&g(kG&z_ zIF)%y8U4TrhJB0^G2~-Hq|=1Jvx0y)l}M>fM^eb?LSK_fRu-!5a)SQ%wQR>tK-D@*f25X?BJAj`*5fW<;BlEM@#d#%QtR(2pL z(u}f^kI^Ct&S+&30mCHYDy1V|lSLvJwlb!MyRs=V$O}RX4#E^U&D7Y=Sde8RnADO% zG3K+e6Tegdzp)+J0{PA6Vs8W(7Mw^v?(56~%RlU3ln*vzjI;l0;4j6j)F|s0000`c BKve($ literal 0 HcmV?d00001 diff --git a/face/logs/teh.log.2024-10-24.0.gz b/face/logs/teh.log.2024-10-24.0.gz new file mode 100644 index 0000000000000000000000000000000000000000..eec9caf85e38fc5daf143d763111c294476fe0af GIT binary patch literal 950 zcmV;n14;ZJiwFP!00000|K*xXi`zOBfcO0s!mAcqp~un7t9xlFw2OA2(@pWl*U=<~ z#16KTQcC}Ok7hE{S(Iy`jX;4g7+KLs=Ziia$^KdWv-Af)FYV!2)sDfb9 z`|*1qB?*r1uHXBaw38<-_T%hp(%cWEsb1sNJf5bf>t&pp45v;3BYPG5|rP3w>s9I_&Krw3~CjxgI%3M%V zRCXVYoGQBzRGc{mS4=RY$^rsI9cIMnrz=LVt}?;hn#zQ;i4(!r!cYJMBASB6jcAb+ zl2jI=kyT|61Qi$!SBo#F$1wg5(+%lZ?B=pa1QEMS$yZY{qtj-AVzrQzDF-}qDbZXM zi6AW>!)WA`*ae?Pd^|cCD3D-Aj|Bukof3v|e#HnPJho;rFe%v>XEj$f18Q+wX?f&P zKbO|pA{iu!EJP!l$o>%I##kA7*k2^UTq3(5(9|dZ5V3pv5)nj*Oo`QmOhVd308s-_ zfon-zLWVV6nK^ONS$~K|PLEyiae??^51LCPn9*YafuhbxE>-N~mJ$&}9FW1P$Apq; z6G6!u7*&c{$s!kYA&e?BElyHdh(=D8JrdN;y2zxuNP-zv77z$3g>mSoD@G8ZvUQWW zRFf(EP$89)&PL|Nz{*UEllGPvjI17e;0Ig*kKNZ4$SPZ{6tN&e<;j0Ol;ip#T5? literal 0 HcmV?d00001 diff --git a/face/src/main/java/gsp/technologies/face/config/FaceProperties.java b/face/src/main/java/gsp/technologies/face/config/FaceProperties.java new file mode 100644 index 0000000..3633abe --- /dev/null +++ b/face/src/main/java/gsp/technologies/face/config/FaceProperties.java @@ -0,0 +1,58 @@ +package gsp.technologies.face.config; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import lombok.Data; + +@Data +@Component +@ConfigurationProperties(prefix = "face") +public class FaceProperties { + private Map construct; + private Map api; + private Map face; + + /** + * Методы извлечения CONSTRUCT + */ + + public String protocol() { + return construct.get("protocol"); + } + public String domain() { + return construct.get("domain"); + } + public String port() { + return construct.get("port"); + } + public String prefix(){ + return protocol() + "://" + domain() + ":" + port(); + } + public String hello() { + return construct.get("hello"); + } + public String linkHello(){ + return prefix() + hello(); + } + + public Map links(){ + Map links = new HashMap<>(); + // перебираем api + for (Map.Entry entry : api.entrySet()) { + String link = prefix() + entry.getValue(); + String key = "face.api." + entry.getKey(); + links.put(key, link); + } + // перебираем face + for (Map.Entry entry : face.entrySet()) { + String link = prefix() + entry.getValue(); + String key = "face.face." + entry.getKey(); + links.put(key, link); + } + return links; + } +} diff --git a/face/src/main/java/gsp/technologies/face/config/SourceProperties.java b/face/src/main/java/gsp/technologies/face/config/SourceProperties.java new file mode 100644 index 0000000..dc32084 --- /dev/null +++ b/face/src/main/java/gsp/technologies/face/config/SourceProperties.java @@ -0,0 +1,59 @@ +package gsp.technologies.face.config; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import lombok.Data; + +@Data +@Component +@ConfigurationProperties(prefix = "source") +public class SourceProperties { + private Map construct; + private Map api; + private Map face; + + /** + * Методы извлечения CONSTRUCT + */ + + public String protocol() { + return construct.get("protocol"); + } + public String domain() { + return construct.get("domain"); + } + public String port() { + return construct.get("port"); + } + public String prefix(){ + return protocol() + "://" + domain() + ":" + port(); + } + public String hello() { + return construct.get("hello"); + } + public String linkHello(){ + return prefix() + hello(); + } + + public Map links(){ + Map links = new HashMap<>(); + // перебираем api + for (Map.Entry entry : api.entrySet()) { + String link = prefix() + entry.getValue(); + String key = "source.api." + entry.getKey(); + links.put(key, link); + } + // перебираем face + for (Map.Entry entry : face.entrySet()) { + String link = prefix() + entry.getValue(); + String key = "source.face." + entry.getKey(); + links.put(key, link); + } + return links; + } + +} diff --git a/face/src/main/java/gsp/technologies/face/config/StorageProperties.java b/face/src/main/java/gsp/technologies/face/config/StorageProperties.java new file mode 100644 index 0000000..27cfbd1 --- /dev/null +++ b/face/src/main/java/gsp/technologies/face/config/StorageProperties.java @@ -0,0 +1,58 @@ +package gsp.technologies.face.config; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import lombok.Data; + +@Data +@Component +@ConfigurationProperties(prefix = "storage") +public class StorageProperties { + private Map construct; + private Map api; + private Map face; + + /** + * Методы извлечения CONSTRUCT + */ + + public String protocol() { + return construct.get("protocol"); + } + public String domain() { + return construct.get("domain"); + } + public String port() { + return construct.get("port"); + } + public String prefix(){ + return protocol() + "://" + domain() + ":" + port(); + } + public String hello() { + return construct.get("hello"); + } + public String linkHello(){ + return prefix() + hello(); + } + + public Map links(){ + Map links = new HashMap<>(); + // перебираем api + for (Map.Entry entry : api.entrySet()) { + String link = prefix() + entry.getValue(); + String key = "storage.api." + entry.getKey(); + links.put(key, link); + } + // перебираем face + for (Map.Entry entry : face.entrySet()) { + String link = prefix() + entry.getValue(); + String key = "storage.face." + entry.getKey(); + links.put(key, link); + } + return links; + } +} diff --git a/face/src/main/java/gsp/technologies/face/controllers/api/v1/ApiController.java b/face/src/main/java/gsp/technologies/face/controllers/api/v1/ApiController.java index d5e1515..0a90dca 100644 --- a/face/src/main/java/gsp/technologies/face/controllers/api/v1/ApiController.java +++ b/face/src/main/java/gsp/technologies/face/controllers/api/v1/ApiController.java @@ -25,6 +25,7 @@ import org.springframework.web.util.UriComponentsBuilder; import gsp.technologies.face.models.FileMetadata; import gsp.technologies.face.models.Post; +import gsp.technologies.face.services.PropertyService; import gsp.technologies.face.teh.fs.Filer; import gsp.technologies.face.teh.fs.MpFile; import jakarta.servlet.http.HttpServletRequest; @@ -43,6 +44,9 @@ public class ApiController { @Autowired private WebClient client; + @Autowired + private PropertyService prop; + /** * Загрузка файла на сервер, * @@ -73,6 +77,7 @@ public class ApiController { try { metadata = client.post() .uri("http://source:8181/api/v1/storage/metadata/create") + // .uri(prop.source().links().get("source.api.metadata-create")) .body(Mono.just(metadata), FileMetadata.class) .retrieve() .bodyToMono(new ParameterizedTypeReference (){}) @@ -93,6 +98,7 @@ public class ApiController { log.info("Отправляем файл в хранилище с новым именем {}.{}", metadata.getId(), metadata.getExtension()); metadata = client.method(HttpMethod.POST) .uri("http://storage:8282/api/v1/files/store") + // .uri(prop.storage().links().get("storage.api.file-store")) .body(BodyInserters .fromMultipartData(builder.build())) .retrieve() diff --git a/face/src/main/java/gsp/technologies/face/controllers/face/v1/MainframeController.java b/face/src/main/java/gsp/technologies/face/controllers/face/v1/MainframeController.java index 254d9d4..96549dc 100644 --- a/face/src/main/java/gsp/technologies/face/controllers/face/v1/MainframeController.java +++ b/face/src/main/java/gsp/technologies/face/controllers/face/v1/MainframeController.java @@ -2,6 +2,7 @@ package gsp.technologies.face.controllers.face.v1; import java.net.URI; import java.time.Duration; +import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,10 +21,9 @@ import gsp.technologies.face.models.Content; import gsp.technologies.face.models.ContentPage; import gsp.technologies.face.models.ContentRequest; import gsp.technologies.face.models.Post; -import gsp.technologies.face.services.LinksService; +import gsp.technologies.face.services.PropertyService; import gsp.technologies.face.teh.pagination.Page; - @Controller @RequestMapping(path = "/face/v1/mainframe") public class MainframeController { @@ -33,16 +33,42 @@ public class MainframeController { private WebClient client; @Autowired - private LinksService links; + private PropertyService prop; @GetMapping("") public String mainframe(Model model, @RequestParam(name = "postContentPage", required = false) ContentPage postContentPage) { log.info("GET /face/v1/mainframe"); - log.info("********* properties ********* "); - // log.info("storage.api.home: {}", env.getProperty("storage.api.home")); - log.info("storage.api.home: {}", links.storageApiHome()); - log.info("face.api.home: {}", links.faceApiHome()); + //линки на ресурсы платформы + { + log.info("********* properties-face ********* "); + Map map = prop.face().links(); + for (Map.Entry entry : map.entrySet()) { + log.info("{}: {}", entry.getKey(), entry.getValue()); + } + } + + { + log.info("********* properties-storage *********"); + Map map = prop.storage().links(); + for (Map.Entry entry : map.entrySet()) { + log.info("{}: {}", entry.getKey(), entry.getValue()); + } + } + + { + log.info("********* properties-source *********"); + Map map = prop.source().links(); + for (Map.Entry entry : map.entrySet()) { + log.info("{}: {}", entry.getKey(), entry.getValue()); + } + } + + { + log.info("********* properties *********"); + String s = prop.env().getProperty("server.port"); + log.info("server.port: {}", s); + } if (postContentPage == null) { //подготовка параметров запроса diff --git a/face/src/main/java/gsp/technologies/face/services/LinksFace.java b/face/src/main/java/gsp/technologies/face/services/LinksFace.java deleted file mode 100644 index 60c99e1..0000000 --- a/face/src/main/java/gsp/technologies/face/services/LinksFace.java +++ /dev/null @@ -1,7 +0,0 @@ -package gsp.technologies.face.services; - -public interface LinksFace { - - String storageApiHome(); - -} diff --git a/face/src/main/java/gsp/technologies/face/services/LinksService.java b/face/src/main/java/gsp/technologies/face/services/LinksService.java deleted file mode 100644 index 2fb0909..0000000 --- a/face/src/main/java/gsp/technologies/face/services/LinksService.java +++ /dev/null @@ -1,149 +0,0 @@ -package gsp.technologies.face.services; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Service; - -@Service -public class LinksService{ - - @Autowired - private Environment env; - - /** - * get links from env: storage - * @return - */ - - public String storageProtocol(){ - return env.getProperty("storage.protocol"); - } - - public String storageDomain(){ - return env.getProperty("storage.domain"); - } - - public String storagePort(){ - return env.getProperty("storage.port"); - } - - public String storageHello(){ - return env.getProperty("storage.hello"); - } - - - public String storageApiHome(){ - return env.getProperty("storage.api.home"); - } - - public String storageApiRoot(){ - return env.getProperty("storage.api.root"); - } - - public String storageApiFiles(){ - return env.getProperty("storage.api.files"); - } - - public String storageApiFileStore(){ - return env.getProperty("storage.api.file-store"); - } - - public String storageApiFileStoreMultiple(){ - return env.getProperty("storage.api.file-store-multiple"); - } - - public String storageApiFileDelete(){ - return env.getProperty("storage.api.file-delete"); - } - - public String storageApiFileDownload(){ - return env.getProperty("storage.api.file-download"); - } - - public String storageApiXlsxPage(){ - return env.getProperty("storage.api.xlsx-page"); - } - - public String storageApiDirectoryCreate(){ - return env.getProperty("storage.api.directory-create"); - } - - public String storageApiDirectoryDelete(){ - return env.getProperty("storage.api.directory-delete"); - } - - public String storageApiFileCreateEmpty(){ - return env.getProperty("storage.api.file-create-empty"); - } - - public String storageApiFileBytes(){ - return env.getProperty("storage.api.file-bytes"); - } - - public String storageFaceHome(){ - return env.getProperty("storage.face.home"); - } - public String storageFaceMainframe(){ - return env.getProperty("storage.face.mainframe"); - } - - public String storageFaceUploadFile(){ - return env.getProperty("storage.face.upload-file"); - } - - public String storageFaceUploadMultipleFiles(){ - return env.getProperty("storage.face.upload-multiple-files"); - } - - public String storageFaceDownloadFile(){ - return env.getProperty("storage.face.download-file"); - } - - public String storageFaceDeleteFile(){ - return env.getProperty("storage.face.delete-file"); - } - - public String storageFaceViewXlsx(){ - return env.getProperty("storage.face.view-xlsx"); - } - - /** - * Get links from env: face - * @return - */ - - public String faceProtocol(){ - return env.getProperty("face.protocol"); - } - public String faceDomain(){ - return env.getProperty("face.domain"); - } - public String facePort(){ - return env.getProperty("face.port"); - } - public String faceHello(){ - return env.getProperty("face.hello"); - } - public String faceApiHome(){ - return env.getProperty("face.api.home"); - } - public String faceApiUpload(){ - return env.getProperty("face.api.upload"); - } - - public String faceApiDownload(){ - return env.getProperty("face.api.download"); - } - public String faceFaceMainframe(){ - return env.getProperty("face.face.mainframe"); - } - public String faceFaceStorage(){ - return env.getProperty("face.face.storage"); - } - - /** - * get links from env: source - */ - - -} \ No newline at end of file diff --git a/face/src/main/java/gsp/technologies/face/services/PropertyService.java b/face/src/main/java/gsp/technologies/face/services/PropertyService.java new file mode 100644 index 0000000..1abe7a9 --- /dev/null +++ b/face/src/main/java/gsp/technologies/face/services/PropertyService.java @@ -0,0 +1,39 @@ +package gsp.technologies.face.services; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Service; + +import gsp.technologies.face.config.FaceProperties; +import gsp.technologies.face.config.SourceProperties; +import gsp.technologies.face.config.StorageProperties; +import lombok.Data; + +@Service +public class PropertyService { + @Autowired + private FaceProperties face; + + @Autowired + private StorageProperties storage; + + @Autowired + private SourceProperties source; + + @Autowired + private Environment env; + + public FaceProperties face(){ + return face; + } + public StorageProperties storage(){ + return storage; + } + public SourceProperties source(){ + return source; + } + public Environment env(){ + return env; + } + +} diff --git a/face/src/main/resources/application-face.yaml b/face/src/main/resources/application-face.yaml index 9a5fefa..718b0f9 100644 --- a/face/src/main/resources/application-face.yaml +++ b/face/src/main/resources/application-face.yaml @@ -1,12 +1,14 @@ face: - protocol: http:// - domain: face - port: 8383 - hello: /hello + construct: + protocol: http + domain: face + port: 8383 + hello: /hello api: - home: /api/v1 - upload: /api/v1/upload - download: /api/v1/download + base: /api/v1 + upload: /upload + download: /download face: - mainframe: /face/v1/mainframe - storage: /face/v1/storage \ No newline at end of file + base: /face/v1 + mainframe: /mainframe + storage: /storage \ No newline at end of file diff --git a/face/src/main/resources/application-source.yaml b/face/src/main/resources/application-source.yaml index e9c24cc..ce89665 100644 --- a/face/src/main/resources/application-source.yaml +++ b/face/src/main/resources/application-source.yaml @@ -1,14 +1,17 @@ source: - protocol: http:// - domain: storage - port: 8181 - hello: /hello + construct: + protocol: http + domain: source + port: 8181 + hello: /hello api: - home: /api/v1 - metadata-list: /api/v1/storage/metadata/list - post-list: /api/v1/storage/post/list - post-page: /api/v1/storage/post/page - post-page-distinct: /api/v1/storage/post/page/distinct - metadata-create: /api/v1/storage/metadata/create - post-create: /api/v1/storage/post/create - metadata-update: /api/v1/storage/metadata/update \ No newline at end of file + base: /api/v1 + metadata-list: /storage/metadata/list + post-list: /storage/post/list + post-page: /storage/post/page + post-page-distinct: /storage/post/page/distinct + metadata-create: /storage/metadata/create + post-create: /storage/post/create + metadata-update: /storage/metadata/update + face: + base: /face/v1 \ No newline at end of file diff --git a/face/src/main/resources/application-storage.yaml b/face/src/main/resources/application-storage.yaml index 2823d95..fc05ec9 100644 --- a/face/src/main/resources/application-storage.yaml +++ b/face/src/main/resources/application-storage.yaml @@ -1,44 +1,45 @@ storage: - protocol: http:// - domain: storage - port: 8282 - # страница описания сервиса - hello: /hello + construct: + protocol: http + domain: storage + port: 8282 + # страница описания сервиса + hello: /hello api: ################################### # основные возможности api # корневая директория сервиса "storage" - home: /api/v1 + base: /api/v1 # перечень файлов, размещенных в хранилище - files: /api/v1/files + files: /files # получение пути к корню файлового хранилища - root: /api/v1/root + root: /root # сохранение файла в хранилище - file-store: /api/v1/files/store + file-store: /files/store # сохранение нескольких файлов в хранилище - file-store-multiple: /api/v1/files/store-multiple + file-store-multiple: /files/store-multiple # удаление файла из хранилища - file-delete: /api/v1/files/delete + file-delete: /files/delete # скачивание файла из хранилища - file-download: /api/v1/files/download + file-download: /files/download # постраничное извлечение данных xlsx-файла в json формате - xlsx-page: /api/v1/files/xlsx + xlsx-page: /files/xlsx ################################### # дополнительные возможности api # создание пустого файла - file-create-empty: /api/v1/files/create + file-create-empty: /files/create # создание диектории - directory-create: /api/v1/dirs/create + directory-create: /dirs/create # удаление директории - directory-delete: /api/v1/dirs/delete + directory-delete: /dirs/delete # получение массива байтов файла, без буферизации file-bytes: /files/get-bytes face: - home: /face/v1 - mainframe: /face/v1/mainframe - upload-file: /face/v1/upload-file - upload-multiple-files: /face/v1/upload-multiple-files + base: /face/v1 + mainframe: /mainframe + upload-file: /upload-file + upload-multiple-files: /upload-multiple-files download: /files/download-file delete: /files/delete-file view-xlsx: /files/view \ No newline at end of file