Add ability to specify address in default.project.json (#507)

* Allow for setting the default port in project json

set as
```json
"serveAddress": "0.0.0.0"
```

* Update CHANGELOG.md

* cargo fmt

Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
This commit is contained in:
Ashton Miller
2022-04-19 15:54:03 -05:00
committed by GitHub
parent 12370846b4
commit 49f8845105
4 changed files with 19 additions and 2 deletions

View File

@@ -1,8 +1,12 @@
# Rojo Changelog
## Unreleased Changes
* Added support for specifying an address to be used by default in the .project.json file ([#447])
* Added support for the new Open Cloud API when uploading. ([#486])
[#447]: https://github.com/rojo-rbx/rojo/issues/447
[#486]: https://github.com/rojo-rbx/rojo/issues/486
## [7.0.0] - December 10, 2021
* Fixed Rojo's interactions with properties enabled by FFlags that are not yet enabled. ([#493])
* Improved output in Roblox Studio plugin when bad property data is encountered.
@@ -10,7 +14,6 @@
* Connection settings are now remembered when reconnecting in Roblox Studio. ([#500])
* Updated reflection database to Roblox v503.
[#486]: https://github.com/rojo-rbx/rojo/issues/486
[#430]: https://github.com/rojo-rbx/rojo/issues/430
[#493]: https://github.com/rojo-rbx/rojo/pull/493
[#500]: https://github.com/rojo-rbx/rojo/pull/500

View File

@@ -41,7 +41,10 @@ impl ServeCommand {
let session = Arc::new(ServeSession::new(vfs, &project_path)?);
let ip = self.address.unwrap_or(DEFAULT_BIND_ADDRESS.into());
let ip = self
.address
.or_else(|| session.serve_address())
.unwrap_or(DEFAULT_BIND_ADDRESS.into());
let port = self
.port

View File

@@ -1,6 +1,7 @@
use std::{
collections::{BTreeMap, HashMap, HashSet},
fs, io,
net::IpAddr,
path::{Path, PathBuf},
};
@@ -67,6 +68,11 @@ pub struct Project {
#[serde(skip_serializing_if = "Option::is_none")]
pub game_id: Option<u64>,
/// If specified, this address will be used in place of the default address
/// As long as --address is unprovided.
#[serde(skip_serializing_if = "Option::is_none")]
pub serve_address: Option<IpAddr>,
/// A list of globs, relative to the folder the project file is in, that
/// match files that should be excluded if Rojo encounters them.
#[serde(default, skip_serializing_if = "Vec::is_empty")]

View File

@@ -2,6 +2,7 @@ use std::{
borrow::Cow,
collections::HashSet,
io,
net::IpAddr,
path::{Path, PathBuf},
sync::{Arc, Mutex, MutexGuard},
time::Instant,
@@ -212,6 +213,10 @@ impl ServeSession {
pub fn serve_place_ids(&self) -> Option<&HashSet<u64>> {
self.root_project.serve_place_ids.as_ref()
}
pub fn serve_address(&self) -> Option<IpAddr> {
self.root_project.serve_address
}
}
#[derive(Debug, Error)]