mirror of https://github.com/halo-dev/halo
Update OptionServiceImpl.java
parent
cd2c3a17b3
commit
dbf12f711c
|
@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import run.halo.app.cache.StringCacheStore;
|
import run.halo.app.cache.StringCacheStore;
|
||||||
|
import run.halo.app.config.properties.HaloProperties;
|
||||||
import run.halo.app.event.options.OptionUpdatedEvent;
|
import run.halo.app.event.options.OptionUpdatedEvent;
|
||||||
import run.halo.app.exception.MissingPropertyException;
|
import run.halo.app.exception.MissingPropertyException;
|
||||||
import run.halo.app.model.dto.OptionDTO;
|
import run.halo.app.model.dto.OptionDTO;
|
||||||
|
@ -41,20 +42,19 @@ import java.util.*;
|
||||||
public class OptionServiceImpl extends AbstractCrudService<Option, Integer> implements OptionService {
|
public class OptionServiceImpl extends AbstractCrudService<Option, Integer> implements OptionService {
|
||||||
|
|
||||||
private final OptionRepository optionRepository;
|
private final OptionRepository optionRepository;
|
||||||
|
|
||||||
private final ApplicationContext applicationContext;
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
private final StringCacheStore cacheStore;
|
private final StringCacheStore cacheStore;
|
||||||
|
|
||||||
private final Map<String, PropertyEnum> propertyEnumMap;
|
private final Map<String, PropertyEnum> propertyEnumMap;
|
||||||
|
|
||||||
private final ApplicationEventPublisher eventPublisher;
|
private final ApplicationEventPublisher eventPublisher;
|
||||||
|
private HaloProperties haloProperties;
|
||||||
|
|
||||||
public OptionServiceImpl(OptionRepository optionRepository,
|
public OptionServiceImpl(HaloProperties haloProperties,
|
||||||
|
OptionRepository optionRepository,
|
||||||
ApplicationContext applicationContext,
|
ApplicationContext applicationContext,
|
||||||
StringCacheStore cacheStore,
|
StringCacheStore cacheStore,
|
||||||
ApplicationEventPublisher eventPublisher) {
|
ApplicationEventPublisher eventPublisher) {
|
||||||
super(optionRepository);
|
super(optionRepository);
|
||||||
|
this.haloProperties = haloProperties;
|
||||||
this.optionRepository = optionRepository;
|
this.optionRepository = optionRepository;
|
||||||
this.applicationContext = applicationContext;
|
this.applicationContext = applicationContext;
|
||||||
this.cacheStore = cacheStore;
|
this.cacheStore = cacheStore;
|
||||||
|
@ -373,7 +373,11 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
|
||||||
if (StrUtil.isNotBlank(blogUrl)) {
|
if (StrUtil.isNotBlank(blogUrl)) {
|
||||||
blogUrl = StrUtil.removeSuffix(blogUrl, "/");
|
blogUrl = StrUtil.removeSuffix(blogUrl, "/");
|
||||||
} else {
|
} else {
|
||||||
blogUrl = String.format("http://%s:%s", HaloUtils.getMachineIP(), serverPort);
|
if (haloProperties.isProductionEnv()) {
|
||||||
|
blogUrl = String.format("http://%s:%s", "127.0.0.1", serverPort);
|
||||||
|
} else {
|
||||||
|
blogUrl = String.format("http://%s:%s", HaloUtils.getMachineIP(), serverPort);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return blogUrl;
|
return blogUrl;
|
||||||
|
|
Loading…
Reference in New Issue