Skip to content

Commit 3aa94bb

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

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
@@ -43,6 +43,14 @@ public enum Lambda {
4343
public static func run(_ factory: @escaping (EventLoop) throws -> ByteBufferLambdaHandler) {
4444
self.run(factory: factory)
4545
}
46+
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+
}
4654

4755
// for testing and internal use
4856
@discardableResult

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)