| | |
| | | import java.text.MessageFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Collection;
|
| | | import java.util.Collections;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | import com.gitblit.models.FederationProposal;
|
| | | import com.gitblit.models.FederationSet;
|
| | | import com.gitblit.models.Metric;
|
| | | import com.gitblit.models.ObjectCache;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.ServerSettings;
|
| | | import com.gitblit.models.ServerStatus;
|
| | |
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JsonUtils;
|
| | | import com.gitblit.utils.MetricUtils;
|
| | | import com.gitblit.utils.ObjectCache;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
|
| | | /**
|
| | |
| | | * @param settings
|
| | | * @return true if the update succeeded
|
| | | */
|
| | | public boolean updateSettings(Collection<SettingModel> settings) {
|
| | | // TODO update the settings
|
| | | return false;
|
| | | public boolean updateSettings(Map<String, String> updatedSettings) {
|
| | | return settings.saveSettings(updatedSettings);
|
| | | }
|
| | |
|
| | | public ServerStatus getStatus() {
|
| | |
| | | model.isFrozen = getConfig(config, "isFrozen", false);
|
| | | model.showReadme = getConfig(config, "showReadme", false);
|
| | | model.skipSizeCalculation = getConfig(config, "skipSizeCalculation", false);
|
| | | model.skipSummaryMetrics = getConfig(config, "skipSummaryMetrics", false);
|
| | | model.federationStrategy = FederationStrategy.fromName(getConfig(config,
|
| | | "federationStrategy", null));
|
| | | model.federationSets = new ArrayList<String>(Arrays.asList(config.getStringList(
|
| | |
| | | config.setBoolean("gitblit", null, "isFrozen", repository.isFrozen);
|
| | | config.setBoolean("gitblit", null, "showReadme", repository.showReadme);
|
| | | config.setBoolean("gitblit", null, "skipSizeCalculation", repository.skipSizeCalculation);
|
| | | config.setBoolean("gitblit", null, "skipSummaryMetrics", repository.skipSummaryMetrics);
|
| | | config.setStringList("gitblit", null, "federationSets", repository.federationSets);
|
| | | config.setString("gitblit", null, "federationStrategy",
|
| | | repository.federationStrategy.name());
|
| | |
| | | */
|
| | | public ServerSettings getSettingsModel() {
|
| | | // ensure that the current values are updated in the setting models
|
| | | settingsModel.updateCurrentValues(settings);
|
| | | for (String key : settings.getAllKeys(null)) {
|
| | | SettingModel setting = settingsModel.get(key);
|
| | | if (setting != null) {
|
| | | setting.currentValue = settings.getString(key, "");
|
| | | }
|
| | | }
|
| | | return settingsModel;
|
| | | }
|
| | |
|
| | |
| | | // Read bundled Gitblit properties to extract setting descriptions.
|
| | | // This copy is pristine and only used for populating the setting
|
| | | // models map.
|
| | | InputStream is = servletContext.getResourceAsStream("/WEB-INF/gitblit.properties");
|
| | | InputStream is = servletContext.getResourceAsStream("/WEB-INF/reference.properties");
|
| | | BufferedReader propertiesReader = new BufferedReader(new InputStreamReader(is));
|
| | | StringBuilder description = new StringBuilder();
|
| | | SettingModel setting = new SettingModel();
|
| | |
| | | repositoriesFolder = new File(settings.getString(Keys.git.repositoriesFolder, "git"));
|
| | | logger.info("Git repositories folder " + repositoriesFolder.getAbsolutePath());
|
| | | repositoryResolver = new FileResolver<Void>(repositoriesFolder, exportAll);
|
| | | serverStatus = new ServerStatus();
|
| | | serverStatus = new ServerStatus(isGO());
|
| | | String realm = settings.getString(Keys.realm.userService, "users.properties");
|
| | | IUserService loginService = null;
|
| | | try {
|
| | |
| | | WebXmlSettings webxmlSettings = new WebXmlSettings(contextEvent.getServletContext());
|
| | | configureContext(webxmlSettings, true);
|
| | | }
|
| | |
|
| | | serverStatus.servletContainer = servletContext.getServerInfo();
|
| | | }
|
| | |
|
| | | /**
|