Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dynamic configuration of http port in the rust sdk #1125

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdks/rust/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::env;
use std::sync::{Arc, Mutex};
use std::thread::sleep;
use std::time::Duration;
Expand All @@ -25,8 +26,6 @@ use grpc::sdk;
use grpc::sdk_grpc;
use types::*;

const PORT: i32 = 59357;

/// SDK is an instance of the Agones SDK
pub struct Sdk {
client: Arc<sdk_grpc::SdkClient>,
Expand All @@ -38,7 +37,8 @@ impl Sdk {
/// Blocks until connection and handshake are made.
/// Times out after ~30 seconds.
pub fn new() -> Result<Sdk> {
let addr = format!("localhost:{}", PORT);
let port = env::var("AGONES_SDK_GRPC_PORT").unwrap_or("59357".to_string());
let addr = format!("localhost:{}", port);
let env = Arc::new(grpcio::EnvBuilder::new().build());
let ch = grpcio::ChannelBuilder::new(env)
.keepalive_timeout(Duration::new(30, 0))
Expand Down