Skip to content

Commit 6c793c4

Browse files
committed
Make Lambda.env() -> String? public
1 parent 920302a commit 6c793c4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/AWSLambdaRuntime/Lambda.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ public enum Lambda {
4444
self.run(factory: factory)
4545
}
4646

47+
/// Utility to access/read environment variables
48+
public static func env(_ name: String) -> String? {
49+
guard let value = getenv(name) else {
50+
return nil
51+
}
52+
return String(cString: value)
53+
}
54+
4755
// for testing and internal use
4856
@discardableResult
4957
internal static func run(configuration: Configuration = .init(), handler: ByteBufferLambdaHandler) -> Result<Int, Error> {

Sources/AWSLambdaRuntime/Utils.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ internal enum AmazonHeaders {
3636
static let invokedFunctionARN = "Lambda-Runtime-Invoked-Function-Arn"
3737
}
3838

39-
/// Utility to read environment variables
40-
internal func env(_ name: String) -> String? {
41-
guard let value = getenv(name) else {
42-
return nil
43-
}
44-
return String(cString: value)
45-
}
46-
4739
/// Helper function to trap signals
4840
internal func trap(signal sig: Signal, handler: @escaping (Signal) -> Void) -> DispatchSourceSignal {
4941
let signalSource = DispatchSource.makeSignalSource(signal: sig.rawValue, queue: DispatchQueue.global())

0 commit comments

Comments
 (0)