001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.autoconfigure.mongo.embedded;
018
019import java.util.Set;
020
021import de.flapdoodle.embed.mongo.distribution.Feature;
022
023import org.springframework.boot.context.properties.ConfigurationProperties;
024import org.springframework.boot.convert.DataSizeUnit;
025import org.springframework.util.unit.DataSize;
026import org.springframework.util.unit.DataUnit;
027
028/**
029 * Configuration properties for Embedded Mongo.
030 *
031 * @author Andy Wilkinson
032 * @author Yogesh Lonkar
033 * @since 1.3.0
034 */
035@ConfigurationProperties(prefix = "spring.mongodb.embedded")
036public class EmbeddedMongoProperties {
037
038        /**
039         * Version of Mongo to use.
040         */
041        private String version = "3.5.5";
042
043        private final Storage storage = new Storage();
044
045        /**
046         * Comma-separated list of features to enable. Uses the defaults of the configured
047         * version by default.
048         */
049        private Set<Feature> features = null;
050
051        public String getVersion() {
052                return this.version;
053        }
054
055        public void setVersion(String version) {
056                this.version = version;
057        }
058
059        public Set<Feature> getFeatures() {
060                return this.features;
061        }
062
063        public void setFeatures(Set<Feature> features) {
064                this.features = features;
065        }
066
067        public Storage getStorage() {
068                return this.storage;
069        }
070
071        public static class Storage {
072
073                /**
074                 * Maximum size of the oplog.
075                 */
076                @DataSizeUnit(DataUnit.MEGABYTES)
077                private DataSize oplogSize;
078
079                /**
080                 * Name of the replica set.
081                 */
082                private String replSetName;
083
084                /**
085                 * Directory used for data storage.
086                 */
087                private String databaseDir;
088
089                public DataSize getOplogSize() {
090                        return this.oplogSize;
091                }
092
093                public void setOplogSize(DataSize oplogSize) {
094                        this.oplogSize = oplogSize;
095                }
096
097                public String getReplSetName() {
098                        return this.replSetName;
099                }
100
101                public void setReplSetName(String replSetName) {
102                        this.replSetName = replSetName;
103                }
104
105                public String getDatabaseDir() {
106                        return this.databaseDir;
107                }
108
109                public void setDatabaseDir(String databaseDir) {
110                        this.databaseDir = databaseDir;
111                }
112
113        }
114
115}