Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 5eb1bfd

Browse files
feat/refactor(#212): modified cdn config structure; package restructured
1 parent b8d8d6f commit 5eb1bfd

15 files changed

+38
-21
lines changed

playground-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/playground/boot/PlaygroundController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class PlaygroundController {
3232

3333
@GetMapping("${graphql.playground.mapping:/playground}")
3434
public String playground(final Model model) {
35-
if (propertiesConfiguration.getPlayground().isCdnEnabled()) {
35+
if (propertiesConfiguration.getPlayground().getCdn().isEnabled()) {
3636
setCdnUrls(model);
3737
} else {
3838
setLocalAssetUrls(model);
@@ -43,7 +43,8 @@ public String playground(final Model model) {
4343
}
4444

4545
private String getCdnUrl(final String assetUrl) {
46-
return String.format("%s@%s/%s", CDN_ROOT, propertiesConfiguration.getPlayground().getCdnVersion(), assetUrl);
46+
return String.format("%s@%s/%s", CDN_ROOT, propertiesConfiguration.getPlayground().getCdn().getVersion(),
47+
assetUrl);
4748
}
4849

4950
private void setCdnUrls(final Model model) {

playground-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/playground/boot/PlaygroundPropertiesConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.oembedler.moon.playground.boot;
22

3+
import com.oembedler.moon.playground.boot.properties.PlaygroundProperties;
34
import lombok.Data;
45
import org.springframework.boot.context.properties.ConfigurationProperties;
56
import org.springframework.validation.annotation.Validated;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.oembedler.moon.playground.boot.properties;
2+
3+
import lombok.Data;
4+
5+
import javax.validation.constraints.NotEmpty;
6+
7+
@Data
8+
public class PlaygroundCdn {
9+
10+
private boolean enabled;
11+
@NotEmpty
12+
private String version = "latest";
13+
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.oembedler.moon.playground.boot;
1+
package com.oembedler.moon.playground.boot.properties;
22

33
import com.fasterxml.jackson.annotation.JsonIgnore;
44
import com.fasterxml.jackson.annotation.JsonInclude;
5-
import com.oembedler.moon.playground.boot.settings.PlaygroundSettings;
65
import lombok.Data;
76

87
import javax.validation.constraints.NotEmpty;
8+
import java.util.Collections;
99
import java.util.List;
1010

1111
@Data
@@ -19,16 +19,12 @@ public class PlaygroundProperties {
1919
private String subscriptionEndpoint = "/subscriptions";
2020

2121
@JsonIgnore
22-
private boolean cdnEnabled;
23-
24-
@NotEmpty
25-
@JsonIgnore
26-
private String cdnVersion = "latest";
22+
private PlaygroundCdn cdn = new PlaygroundCdn();
2723

2824
@JsonIgnore
2925
private String pageTitle = "Playground";
3026

3127
private PlaygroundSettings settings;
3228

33-
private List<PlaygroundTab> tabs;
29+
private List<PlaygroundTab> tabs = Collections.emptyList();
3430
}
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
package com.oembedler.moon.playground.boot.settings;
1+
package com.oembedler.moon.playground.boot.properties;
22

33
import com.fasterxml.jackson.annotation.JsonInclude;
44
import com.fasterxml.jackson.annotation.JsonUnwrapped;
5+
import com.oembedler.moon.playground.boot.properties.settings.PlaygroundEditorSettings;
6+
import com.oembedler.moon.playground.boot.properties.settings.PlaygroundPrettierSettings;
7+
import com.oembedler.moon.playground.boot.properties.settings.PlaygroundRequestSettings;
8+
import com.oembedler.moon.playground.boot.properties.settings.PlaygroundSchemaSettings;
9+
import com.oembedler.moon.playground.boot.properties.settings.PlaygroundTracingSettings;
510
import lombok.Data;
611

712
@Data
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
package com.oembedler.moon.playground.boot;
1+
package com.oembedler.moon.playground.boot.properties;
22

33
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
4+
import com.oembedler.moon.playground.boot.ResourceSerializer;
45
import lombok.Data;
56
import org.springframework.core.io.Resource;
67

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.oembedler.moon.playground.boot.settings;
1+
package com.oembedler.moon.playground.boot.properties.settings;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.oembedler.moon.playground.boot.settings;
1+
package com.oembedler.moon.playground.boot.properties.settings;
22

33
import com.fasterxml.jackson.annotation.JsonInclude;
44
import lombok.Data;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.oembedler.moon.playground.boot.settings;
1+
package com.oembedler.moon.playground.boot.properties.settings;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.oembedler.moon.playground.boot.settings;
1+
package com.oembedler.moon.playground.boot.properties.settings;
22

33
import com.fasterxml.jackson.annotation.JsonInclude;
44
import lombok.Data;

0 commit comments

Comments
 (0)